texts: Custom validator for checking if fields match

texts:
I have two fields, value and copy that I'm trying to do some custom validation on to make sure they roughly match each other.

So far in my module I have this:

function HOOK_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle)
{
    if(!empty($fields['field_value']) && !empty($fields['field_copy']))
    {
        $fields['field_copy']->addConstraint('CopyMatchesValue');
        $fields['field_value']->addConstraint('CopyMatchesValue');
    }
}

A constraint

<?php

namespace Drupal\MODULE\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Checks that value matches copy
 *
 * @Constraint(
 *   id = "CopyMatchesValue",
 *   label = @Translation("Copy Matches Value", context = "Validation"),
 * )
 */
class CopyMatchesValue extends Constraint
{
    // The message that will be shown if the format is incorrect.
    public $copyValueMismatch = 'The value does not look like it matches the copy.';
}

And a validator

<?php

namespace Drupal\MODULE\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

/**
 * Validates the CopyMatchesValue constraint.
 */
class CopyMatchesValueValidator extends ConstraintValidator
{
  /**
   * {@inheritdoc}
   */
  public function validate($items, Constraint $constraint)
  {

      foreach ($items as $key => $item) {
          var_dump($item->value);
      }
      exit;

      // do some processing to make sure they match

      $this->context->addViolation();
    }
  }
}

I was expecting $items to have both fields I added the constraint to, but that doesn't seem to be the case.

How can I pass two fields to one validator so that I can validate them against each other?


texts: Determine Where Values Are Added to Render Array in Drupal 7

texts:
I am trying to determine where specific values are being added to the render array.  I am chasing down a bug that hides HTML when a particular module is installed and adds back that HTML when a second module is installed.

I am using NetBeans and XDebug and setting breakpoints at various drupal_render lines but there are so many and I am not sure if setting the breakpoint at the drupal_render declaration in common.inc is helping.

Any suggestions?

Thanks


texts: Allow module to overwrite multiple templates from module

texts:
I have a couple paragraphs set up in my content type.  I would like to overwrite the templates from my module (long story - we want to reuse this same set up across multiple sites if I get this to work).

I used the following hook in my module:

/**
 * Implements hook_theme_registry_alter().
 */
function my_module_theme_registry_alter(&$theme_registry) {
  $theme_registry['paragraph']['path'] = drupal_get_path('module', 'my_module') . '/templates/paragraph';
  $theme_registry['paragraph']['template'] = 'paragraph';
}

In my module's templates/paragraph folder I have the following files:

paragraph.html.twig
paragraph--accordion.html.twig
paragraph--carousel.html.twig

Here is theme debug:

<!-- THEME HOOK: 'paragraph' -->
<!-- FILE NAME SUGGESTIONS:
   * paragraph--accordion--default.html.twig
   * paragraph--accordion.html.twig
   x paragraph--default.html.twig
   * paragraph.html.twig
-->
<!-- BEGIN OUTPUT from 'modules/contrib/bootstrap_paragraphs/templates/paragraph/paragraph.html.twig' -->

It seems to work but the problem is that paragraph--accordion and paragraph--carousel always use paragraph.html.twig.  How can I have paragraph--accordion and paragraph--carousel use the templates that are in my module. If I place them in my theme's template folder they do render.


texts: How can I track statistics on my site's user population?

texts:
I have a site with a fairly large number of users and I am trying to track statistics on them over time.

For example, users can have:

Any combination of four roles
One of two values for gender
One of two values for an additional field

I want to track each combination of role, gender, and additional attribute separately.

This has lead me to use Views to create a huge number of content panes, each with filters set to catch a particular combination.  I then added all of these to a panel, where I view them once a week and write the numbers down.

However, I now want to add an additional field with 6 additional values.  Creating all those combinations in Views is going to be a mess.  Is there a more efficient way to do this rather than clicking through the Views UI, creating a content pane for each possible combination, and then adding that in Panels?


texts:
I've tried to create a new View Filter with a module. After the upload and activation of my module, I got a White Screen. So I decided to deactivate and delte my module again. Now I'm stuck with this message everywhere:

Fatal error: Class 'view' not found in /var/www/cosmicdesign.at/www/html/antiquariat/sites/all/modules/views/views.module on line 1604

I tried to deactivate views, but that don't do anything. Also cleared the cache in the db (as I can't access the backend). Anyone got a solution to bring the site up and running again?


texts: I am a newbie, I am in the middle of the website which was already created using the bartik theme and I want to change the theme completely like the way Main-menu looks and adding the slideshow in the middle of the page. I really don't understand how to do it. Any suggestions? Thanks.


texts: Template suggestion for 'content' in custom page

texts:
I need the equivalent for hook_preprocess_node for custom pages, which aren't nodes.

The particular page I need to theme is provided by the entity registration module 'node/10/register'. I can add theme suggestions for the page using hook_preprocess_page - but how to I add a theme suggestion for the actual content, so I don't have to rewrite the page.tpl.php?

Alternatively if there is an existing pattern to name the file then that would be even better.


texts: BaseFieldDefinition change DB column type

texts:
In a content entity definition, I've got the following:

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields = parent::baseFieldDefinitions($entity_type);

  $fields['frames'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Frames'))
  ->setDescription('A serialized representation of the given frames');

  return $fields;
}

This is creating the column type in the database as varchar, with a maxlength of 255. I need the column to be type text, as the length will be unknown, and often more than 255. Does anybody know how to create a BaseFieldDefinition that becomes type 'text' in the database when the content entity is enabled?


texts: Am I able to remove unneeded field/migration tables from the database manually?

texts:
I have been working on my site for three months now and I have noticed that the number of empty tables in my database has grown considerably.  Upon closer inspection, I saw that these tables were use by fields belonging to content types that have been removed from the site.  Apparently Drupal does a bad job of removing field tables when you simply delete a content type.  Is it OK for me to delete these tables manually, or will doing this break code (I have been seeing plenty of mysterious, field related errors lately.)  If so, is there anything else besides the field table that I can remove?

The same question is also asked about the migration tables.  Can I get rid of them if they don't go away?


texts: 'og:url' meta property displaying wrong path, messing up posting on external sites

texts:
I'm trying to post a link to a landing page on my Drupal site, like http://me.mysite.com/aboutme. When I post it to Facebook, the link that pops up is to http://me.mysite.com/node/xyz. node/xyz is an actual node on my site, and content from it appears in a panel that's on http://me.mysite.com/node/xyz but it's only like 1/16 of the content of the page, and I have a lot of other panels on that page too. Why is it picking this one? How do I get it to link to the actual page I'm giving the URL for?

Here's a screenshot of my meta tags config:


texts:
I am working on a custom shop module.

i have a custom entity content for my products and i want add some configuration for shipment.

For example :

my product has a weight and differents price for a weight.

So i have 3 way i think :

Custom table, but i am looking for a better way
Config Entity ?
Entity content ?

i use drupal console, but when i create a ConfigEntity type, i can't add custom field like weight / price.
I can juste create a line with a machine name, i don't know how work this entity.

I need to add line like this :

First item
Weight min : 100
Weight max : 500
Price : 10$

Second item
Weight min : 500
Weight max : 1000
Price : 20$

.......

What i should use for add config like this ?

Custom tables ? Config Entity ? Entity content ?


texts: Ubercart rule to modify user profile field

texts:
I have set up a product and a rule to change the value of a custom profile field. How do I link the ubercart product to the rule so that once a user buys the product, the rule kicks into action and modifies the field?

I created the rule via:

Config->Rules

In the rule UI, I did the following:

Events = Customer completes checkout

Conditions = None

Actions = Set a data value (this is where I set the field value)


texts:
I have a form (webform) in a lightbox. I created a link:

show Form

and change 'page--node--lightbox2.tpl.php' (tpl from lightbox2 module) for this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>">

<body id="lightboxnode-<?php print $node->type ?>">

<?php //dsm($node); ?>

<?php if ($title): ?>

<?php print $title; ?>

<?php endif; ?>
<?php
    $nodo = $node->nid;
    print render(node_view(node_load($nodo), 'full', NULL));
?>

How can I do for when I click submit, send the form and close the lightbox?


texts: How to declare a click on a particular tab to be a new event for use with Rules?

texts: I want to declare a click on a particular quicktab or any other tab as a new event for use in a rule. For example, when the user clicks that specific tab, an e-mail is sent to an admin. How can I make this click trigger a new event?


texts:
How to add in Drupal 8 a custom (suggestion) default contact page template ?

Thank you


texts: Image generation in progress. Try again shortly. (503 service unavailable)

texts:
I have two exact copies of the same code installed in the same server running a common AMP stack (I am using bitnami). One copy is named as 'dev' and another one is 'prod'.

Only they have their own database & files (which are clones as well).

In dev, Image styles work just fine. I do drush if - it deletes the styles and creates when viewed.

But in prod, drupal throws 503 service unavailable with a Image generation in progress. Try again shortly. content on the first hit (or until the image is generated).

Of-course that comes from image.module line 858, when drupal finds a lock. And somehow setting image_allow_insecure_derivatives to TRUE might solve this issue.

What I don't understand is why its happening! And whats the remedy?

Thanks!


texts: How to calculate months in cck date field?

texts:
I have 2 cck fields
1. date field with unlimited entries with to date option
2. text field.

i am trying todo is when i enter To and From date automatically update text fied with total no. of years and month calculate.

Like:
to date : 14-Dec-2010
from date :14-Dec-2011

text field displayed 12 months
How may i do this?


texts: Having trouble printing my theme from a custom module

texts:
I created a custom tpl.php page with some basic HTML:

TEST

And a module file that defines the theme:

function my_module_test_theme($existing, $type, $theme, $path) {
    $items = array();

    //Test
    $items['test_test'] = array(
        'template' => 'test-test',
        'path' => drupal_get_path('module', 'my_module') . '/templates',
    );

    return $items;
}

But when I try to print it out in my theme it doesn't work:

<?php $output = theme('test_test'); ?>

Am I printing out the theme in my site's theme's page.tpl.php incorrectly?


texts: How would you programmatically create taxonomy term? I wish to bulk create some in a custom module.


texts: How to restrict permissions for administering Taxonomy?

texts:
I would like a user role to be able to add/edit terms for a specific vocabulary, but not all vocabularies.

In the permission settings for taxonomy, it seems that I need to give the role permission to 'Administer vocabularies and terms'. But then they can edit all vocabularies; the edit/delete permissions for each vocabulary don't have any effect?

I've seen various taxonomy access modules, but they seem to restrict the use of terms on nodes etc. My situation is more simple; a specific role just needs to be able to add additional terms to a vocabulary.

What am I missing here?


texts: Why does field_get_items() sometimes return "blank"

texts: field_get_items('node', $my_node_object, 'field_[fieldname]') is returning the string 'blank'. Not an array, not NULL, but a string reading 'blank'. It's causing errors in media_wysiwyg module. What causes this? How can I fix it?


texts: How to render ctools_custom_content_type_edit_form with ctools_modal_form_wrapper()

texts:
I have a scenario where I would like to reload/re-render the ctools_custom_content_type_edit_form after closing another ctools modal. To do so, I've bound an ajax object to the .close element within the open modal that will fire an ajax callback to open the ctools_custom_content_type_edit_form again.

My ajax callback looks like this, where the parent form is an argument in the menu callback. In this particular scenario, that form id is ctools_custom_content_type_edit_form.

The form is rendered, but it seems to be missing fields: Administrative Title, Title, Body. Any help would be appreciated. Let me know if you need more information.

function mymodule_parent_modal_callback($js, $parent_form_id) {
  // Convert parent form id
  $parent_form_id = str_replace ('-', '_', $parent_form_id);
  $path = '' . drupal_get_path('module', 'wysifield');

  if ($js) {
    ctools_include('modal');
    ctools_include('ajax');
  }
  else {
    // Someone navigated to the AJAX endpoint.
    drupal_access_denied();
  }

  $form_state = array(
    'ajax' => TRUE,
    'title' => t('Parent Modal Form'),
  );

  $commands = ctools_modal_form_wrapper($parent_form_id, $form_state);

  // If form has been submitted, execute other ajax commands.
  if (!empty($form_state['executed'])) {
    // Add the responder javascript, required by ctools
    ctools_add_js('ajax-responder');

    // Create ajax command array, dismiss the modal window.
    $commands = array();
    $commands[] = ctools_modal_command_dismiss();
  }

  print ajax_render($commands);
  drupal_exit();

}


texts:
One way is to use $node->field_myfield[LANG][0][value]="value" that needs another line for getting field's language using field_language().

Is there an easier and cleaner way?


texts: How to add a button or link to perform an action on a node with node_view?

texts:
I wonder how to add a button or link to perform an action of _create_node function. I understand on how to do it on the node edit screen, but not the display.

I want a button of create "new item" on the node display. I'm creating a custom module to create the new node, but need a button to call it.

Any suggestions?


texts: Language switcher in a modal window (pop-up)

texts:
I really got quite far on this issue. Using Drupal 8's Modal API. Having a button in a block that triggers the modal with Drupal's language switcher inside. Everything looks fine EXCEPT for the URLs this modal returns. Every URL gets appended with ?ajax_form=1&_wrapper_format=html which breaks the whole functionality. For example http://d8.dev/fr/node-41-article?ajax_form=1&_wrapper_format=html.

I also tried it with a Controller instead of a Form. But then the URLs look even worse, since then they only take the controller path to create the langswitch URLs.

I already started to guess I'd need to start over using a more independent approach. But maybe you folks know a way to get it working with my current approach? Is there a way I can simply cut off the query? Here is what I have so far:

<?php

/**
 * @file
 * Contains \Drupal\langswitch_modal\Form\LangswitchModal.
 */

namespace Drupal\langswitch_modal\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;

/**
 * Class LangswitchModal.
 *
 * @package Drupal\langswitch_modal\Form
 */
class LangswitchModal extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'langswitch_modal';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

    $form['actions']['#type']  = 'actions';
    $form['actions']['submit'] = [
      '#type'  => 'submit',
      '#value' => $this->t('Switch language'),
      '#ajax'  => [
        'callback' => '::open_modal',
      ],
    ];

    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

  }

  public function open_modal(&$form, FormStateInterface $form_state) {

    $block   = \Drupal\block\BlockViewBuilder::lazyBuilder('languageswitcher', 'full');
    $render  = \Drupal::service('renderer')->renderPlain($block);
    $title   = $this->t('Choose language');
    $content = $render;
    $options = [
      'dialogClass' => 'popup-dialog-class',
      'width'       => '300',
      'height'      => '300',
    ];

    $response = new AjaxResponse();
    $response->addCommand(new OpenModalDialogCommand($title, $content, $options));

    return $response;
  }
}


texts: Why we use dependencies keyword in {theme}libraries.yml ? and not just include the file?

texts:
in the {theme}.libraries.yml why we need to declare the jquery js or any other library as a depedency :
  js:
    assets/lib/bootstrap-4.0.0-dist/js/bootstrap.js: {}
    assets/script.js: {}

 dependencies:
     - core/jquery

an not just include it for example as a simple js, before all other js that depends on it :
  js:
    assets/jquery.js: {} # load dependency library before the dependent libraries.
    assets/lib/bootstrap-4.0.0-dist/js/bootstrap.js: {}
    assets/script.js: {}

in the 2nd scenario the js file ex: jquery will be loaded before the other js files.
so what is the difference?


texts: Simplenews condition results in double email

texts:
I've got a simple rule sending a notification email to site admin on the event 'A user has been subscribed'.

I'm however getting 2 emails on a signup. Any idea why and how to fix so the admin only gets notified once on each signup?

SimpleNews Version: 7.x-1.1
Core Version: 7.39


texts: How do i use hook_menu to add a menu item into an exisiting menu

texts:
as the title says i'm trying to add a menu item to the user-menu. I'm using the following code:

function sawqr_menu() {
    $items['user/%user/qr'] = array(
            'title' => t('QR Code Management'),
            'page callback' => 'sawqr_view_embed',
            'page arguments' => array('qr_codes', 'page'),
            'access callback' => 'user_access',
            'access arguments' => array('Administer SAWQR'),
            'menu_name' => 'user-menu',
            'type' => MENU_SUGGESTED_ITEM,
            'weight' => 0
    );

    return $items; /// forgot to add this from my module
}


texts: How to set published status to a static value while importing a CSV using Feeds

texts:
How can I set the published status of a node created by Feeds to unpublished for every node it imports?

I am using a manually uploaded CSV file.


texts: A view with exposed sort: can i turn off 'grouping field' for different sort criteria?

texts:
My Views list of events is grouped by the date (using the Grouping Field checkbox in the Style settings).

But my exposed Sort Criteria can sort the list by either date or by name.

An alphabetical list of events grouped by date really doesn't make any sense.

What would make sense is for the Grouping Field to turn off when the Sort Criteria is by name.

I'm thinking either i do two views, and my template decides which view to embed depending on the URL query. Or perhaps a views hook like hook_views_query_alter() could turn off the Grouping Field depending on the circumstances?


texts:
Has anyone ever come across the need to pass on values for product attributes in Ubercart through URLs? I've been trying to find something and the closest is https://www.drupal.org/project/uc_attribute_tokens, but this doesn't appear to be maintained well and the documentation is a little lacking. I'd appreciate any help in this.

Thanks! Matt


texts: How to use different sets of fields for unique pages like the home page?

texts:
Some pages, like the home page, have unique content/layouts that are very different from basic pages. I want the editor to be able to fill in a different set of fields for the home page. Currently, the only way I can achieve this is by making a "Home Page" content type and setting up its fields. However, that feels wrong to make a whole content type for just one page. It would be great if the editor can create a basic page, then choose a layout (maybe a dropdown with the options: Default Page, Home Page, About Page, etc). Each layout would have it's own set of fields.

In WordPress, this can easily be achieved by assigning fields (usually with the Advanced Custom Fields plugin) to different page templates. I would love to replicate this in Drupal.


texts:
How do I grab the Node ID in the URL of the current page and pass it through a link?

1) The URL on the current page is in the format:  website.com/parameter/parameter/parameter and the third parameter is the Node ID.
2) I want to grab that Node ID and put it into a link on that page like Link

The screen capture illustrates this.

screen capture


texts: How to create a node and populate its fields with info from a completed goal?

texts:
I need to create a node and populate its fields with data from a completed Goal (implemented via the Goals module) using Rules. The completed Goal info is fetched using the method from the question about "How to fetch the completed goal as an entity with the Rules module?".

The tokens are available for message display action and also for the node title, but I can't use them for any other fields for some reason. How can I use these tokens to populate the other node fields?


texts:
I am using Flagcoolnote module to get some information from user while flagging the node via webform. It is working fine. But the problem is the webform submissions don't show any reference to node the user has flagged like node_id, title etc.

I had gone through the link:http://drupal.org/node/1524430, which says that issue has been resolved and support has been provided, but I am not finding as how can I create view that shows the user submitted data while flagging, with relation with flagged node.

Please suggest.

-- Thanks for your time.


texts:
I've just started with Drupal and I'm trying to create the following URL structure with PathAuto and Entity Reference:

Category A -> Category B -> Category C

Resulting in

category_a/category_b/category_c

For display purposes, I have to define the entity reference on the parent entity. IE:

On Category A, define an entity reference to nodes of Category B.

However, in PathAuto it appears that I can only reference child entities, not parent entities.

I have referenced this article (Path alias tokens and node references) which describes the solution if the entity reference is defined on the child, not the parent.

Is there any way to achieve the above?

Entity Reference 7.x-1.1
PathAuto 7.x-1.2
Entity Tokens 7.x-1.5


texts: How to change status and update account?

texts:
How can i change status to 0 and update an existing user account?

Here is the code i tried:

$account = \Drupal::currentUser();
$account->status = 0;
$account->save();

It gives me error :  Call to undefined method Drupal\Core\Session\AccountProxy::save().


texts:
I don't know beacuse drupal duplicate one of my javascript files...

So:

I had added file "Intro.js" with template.php.
I wrote:

if(drupal_is_front_page()){
  drupal_add_js(path_to_theme() . '/scripts/Intro.js');
}

In the front page I wrote the call for that file.js

For optimize the web site I have "Advagg module"
If I analyze my web site with Pingdom tools i see that there are two files "Intro.js":

Intro.js

Intro.js?ni7wan

BUT i think that the part after "?" change when the cron ran. Is there a solution to delete the duplicate?


texts: How to display records in table programmatically?

texts:
I'm using Drupal 8.0.1. I'm starting to develop a new custom module for learning purpose. Just I have created one form. From the form, the values are stored in my custom table. Now I want to show the records in separate page.

In drupal 7, I have used

  $query = db_query('SELECT id,name,email,age,gender FROM {learning}');
  $rows = array();
  while ($data = $query->fetchAssoc()) {
      // Fill the table rows
    $data['operation'] = l(t('Delete'), 'admin/people/survey/' . $data['id'] . '/delete');
    $data['operation'] .= "|";
    $data['operation'] .= l(t('Edit'), 'admin/people/survey/' . $data['id'] . '/edit');
    $rows[] = array('data' => $data , 'style' => 'word-break:break-all;' , );
  }
  //Number of records shown in per page
  $per_page = 4;
  $current_page = pager_default_initialize(count($rows), $per_page);
  $chunks = array_chunk($rows, $per_page, TRUE);
  // Prepare table header
  $header = array(t('ID'), t('Name'), t('Email'), t('Age'), t('Gender'), t('Operations'));
  // Output of table with the paging
  $output = theme('table',
    array(
      "header" => $header,
      "rows" => $chunks[$current_page],
      "attributes" => array(),
      "sticky" => TRUE,
      "caption" => "",
      "colgroups" => array(),
      "empty" => t("No Survey Records has been found")
    )
  );
  //return pager with limited number of records.
  return $output .= theme('pager', array('quantity', count($rows)));;

And this was working fine in drupal 7. I just want to do same in the Drupal 8. When I put this code in drupal 8 it shows error theme() not found. How can I create the table to show the list of records from my custom table.


texts:
I need to remove title from rendered custom entity.

unset($entity->title) is not good because i still need to use its value in this rendered entity to use in markup.

css display:none is not good idea on my point of view as well.


texts: How to upload videos and play in Drupal 7?

texts:
I am trying to upload custom video files to Drupal site and play the video. I have custom videos which are to be uploaded to posts.

Here I am not using any YouTube embedded links, instead I want to upload my own videos into my posts.

I also have installed the media module and the JWplayer but I don't know how to configure the module to upload videos in my posts and play those videos.

I am a newbie to Drupal. Can anyone help me to configure this?


texts: I am using drupal commerce for an e-commerce site. I have a view for listing the product. I want to show download count oof each product in product listing page as mentioned in the screenshot. How can I achieve this?


texts: How do I vary PathAuto paths based on a field?

texts:
I have a field type called "Venue". If the Venue is in the US, I want the path to be:

/CITY/my-venue

But if it's in any other country, the path must be:

/AU/CITY/my-venue

In other words, non-US venues must get their country code appended to the front.

Is this even possible with the current PathAuto module? Or how can one do this?


texts: Understanding page-title.html.twig and/vs field--node--title.html.twig

texts:
This question is based on the desire to have only one wrapping tag around the title value. (I am utilizing the block system to render the page/node title)

Both of the templates utilize some sort of attribute array on the wrapping element, so I am not sure it is safe to remove either.

I am hoping to better understand why there are two levels to this elements theming, and maybe more importantly, would it be detrimental to remove the attributes from the field--node--title.html.twig?

page-title.html.twig:

{{ title_prefix }}
{% if title %}
  <h1{{ title_attributes }}>{{ title }}</h1>
{% endif %}
{{ title_suffix }}

field--node--title.html.twig:

<span{{ attributes }}>
  {%- for item in items -%}
    {{ item.content }}
  {%- endfor -%}
</span>


texts: Programmatically created content type don't have a delete link

texts:
I'm developing a module that creates new content types through form that I created (not in hook_install):

function create_new_content_type($type, $name){
    $t = get_t();

    $new_node = array(
        'type' => $type,
        'name' => $name,
        'base' => 'node_content',
        //'description' => 'This is an example node type with a few fields.',
    );
    $content_type = node_type_set_defaults($new_node);
    node_add_body_field($content_type);

    // Check if we create content type or update.
    $status = node_type_save($content_type);

    // Replacement rule for the messages.
    $t_args = array('%name' => $content_type->name);

    if ($status == SAVED_NEW) { // create case
        watchdog('node', 'Added content type %name.', $t_args, WATCHDOG_NOTICE, l($t('view'), 'admin/structure/types'));
        return true;
    }

    return false;
}

When I go to admin/structure/types these I don't see the delete link.
I found here some similar questions that suggest to remove with /admin/structure/types/manage/<content-type-name>/delete but it's not a good solution for me.
Is it possible to display that link?

EDIT:
This is what I mean:


texts: Scrolling in chrome shears text and elements

texts:
the testing version of a portfolio site I'm working on started behaving strangely in the past few days. This might or might not be a problem related to drupal itself, but I've never come across this on a non-drupal project.

http://beta.mattgrossdesign.com/about

On my Win7 machine, Chrome 36, scrolling the page causes all the fixed position elements to be rendered in multiple places or sheared off.

Image Reference: http://imgur.com/a/uCYfC

Firefox & IE aren't having problems, any ideas?

Thanks a bunch


texts:
I know  I can have pager with db_select as example

$query = db_select('node', 'n')
      ->condition('type', 'article')
      ->fields('n')
      ->extend('PagerDefault')
      ->limit(30);

is this possible has pager with EntityFieldQuery ?


texts: Error when running database update: "DatabaseSchemaObjectExistsException: Cannot add field redirect.status: field already exists."

texts:
I'm getting the following error when attempting to run a database update:

Update #7101
Failed: DatabaseSchemaObjectExistsException: Cannot add field redirect.status:
field already exists. in DatabaseSchema_mysql->addField()
(line 336 of /var/www/sitename/drupal/web/includes/database/mysql/schema.inc).

It looks like the database update it do to some redirects I added. How do I go about solving this?


texts: Can I add Vertical Tab on a Node Edit Page in admin

texts:
I am hoping to add a custom Vertical Tab in node edit page. Is it possible?

As an example, someone did it like this:-

Thanks


texts: Ajax'ed file field doesn't find the form constructor function on rebuild

texts:
I'm manually printing the user profile form in a block using:

module_load_include('inc', 'user', 'user.pages');
$form = drupal_get_form('user_profile_form', $user);

That works great for displaying and submitting the form.

The form has an image field to add a picture. When I try to upload the picture through Ajax, I get a PHP notice that drupal_retrieve_form() is missing the form constructor function (user_profile_form()), and the image field isn't being shown anymore.

I'm guessing the image field's Ajax doesn't know about the user.pages file that I included, and can't find the form.

Any idea how to fix this?


texts: How to add link module in Bootstrap Paragraphs?

texts:
I experiment with the xeno_hero module and Bootstrap Paragraphs module in order to create a call to action block. I want to create an image background with a centered linked textfield.

I tried a lot of options. The option of a link is not given so I tried to add link (core module) to dependencies like this

dependencies:
  config:
    - field.field.paragraph.xeno_hero.xeno_background_image
    - field.field.paragraph.xeno_hero.xeno_content
    - field.field.paragraph.xeno_hero.xeno_invert
    - field.field.paragraph.xeno_hero.xeno_offset
    - field.field.paragraph.xeno_hero.xeno_overlay
    - field.field.paragraph.xeno_hero.xeno_parallax
    - paragraphs.paragraphs_type.xeno_hero
    module:
    - entity_reference_revisions
    - image
    - options
    - link

And copied the link.schema.yml file from core to custom module. So far no good.

How can I add a linked textfield?


texts: Lets say I have a node type that has a file field(docx,pdf etc). Is there a way to get drupal to show the file directly on node view instead of having the user to navigate to the node and then click on the file to view it?


texts: Displaying Taxonomy Terms which are used by a Content Type

texts:
I have created a taxonomy named Category which has a number of terms like Agriculture, Business, Computers, etc.

I have created three content types viz. Products, Suppliers and Buyers. All of these types use the terms from the Category taxonomy.

What I am trying to do is create a block named Supplier Categories which as the name suggests, displays a list of terms from the Category taxonomy which are associated to Suppliers. So say if you have Suppliers associated to the Agriculture and Business categories then this Block should show them. It shouldn't show Computers though because no Supplier uses this term.

I am not sure whether this is possible or not but I have spent a lot of time playing with blocks but I couldn't get it to work.

By the way, I am trying to do this using Drupal 7.


texts: Is it possible to show all languages on the node edit form?

texts:
I am developing a drupal website with two languages. The main node type has a lot of fields, but only two are translatable.

Is it possible to show the input fields from both languages on the main edit form?


texts:
The Metatag Module inputs (Such as Description, Abstract, ETC, and that includes Page Title) won't trigger on the home page.

I already read in a forum thread that didn't give an in-program solution. I assume it's a solved problem, because it affects almost any site.

How can one solve it?


texts: Linking content of one field to content of another

texts:
I have a content type with an image field and a file field, being outputted in views. How do I want the image to link to the file.

How do I approach this? Make a template for the image field? And if so, how do I get the file field link from that template?

I'm using Drupal 7.


texts: Slide a slideshow upon clicking a botton in it

texts:
I have a jcarousel displaying full contents including some fields. Two flags are also included. If any flag is clicked, say A or B, I want d jcarousel to show the next content and so on, so that d user will not need to click on 'next' himself.
Moreso, the contents may be very long. I want d next slide to show from rhe top and not needing one to scroll up again.
Thanks


texts: What's the default weight of a form's submit element?

texts:
The following code is fairly standard for adding a submit button to the bottom of a form:

// Submit button.
$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
);

It always appears at the bottom of the form so I assume it is assigned a 'heavy' #weight by default. Does anyone know its default value?


texts: How to use two pages of a View with the same path depending on users's profile?

texts:
I created a View on a custom Content Entity.
I'd like to have 2 pages:

the first with all the fields from my entity, no filters, accessible
by users with Edit rights on the entity,
the second one with some of
the fields, filtered by one criteria, accessible by users with View
rights on the entity.

And, of course, with the same path, e.g. [mysite]/myEntity.
How do I do that?
I use Drupal 8.3.4.


texts: Change URL when change language on click language switcher

texts:
I  have Four Different languages Chinese,Portguese,Spanish and English.
My Question is Portguese,Spanish and English same url (example.com) and when user change /click on chinese language icon, change the URl(chineseexample.com).How we can done it?


texts: How to translate Views header syntax? not Title

texts:
In a view, i have filter content using "Language". it works fine. i have added "header" contain HTML syntax (which will be shown with top of view) like:

Text need to translate

i couldn't translate this syntax.

can anyone suggest how it will be translate??


texts: How to upload files to the sites/default/files place without going to the Cpanel backend just through admin backend?

texts:
How to upload files to the sites/default/files folder without going to the Cpanel backend, just through the admin backend?

I need to put there a set of Ubercart images to make a bulk product import via feeds and .csv sheet.


texts: Where do I find extensive taxonomy repositories?

texts:
Where might one find an extensive repository of taxonomy terms divided into different vocabularies?

Cheers,


texts: Using Feeds to import multiple languages

texts:
I've already imported a data set of about 1500 articles, all in English. I have another set of the data with matching node ids but in different languages. Can I import a second file into Drupal 7 and have the localized content mesh up with the existing data?

Currently when I try to import the data it overwrites the existing content, I need them to co-exist with the only difference being a language code.


texts: Installing require-dev dependencies from core/composer.json

texts:
I understand the composer-merge-plugin allows the Drupal root composer.json file to load core/composer.json on runtime. I also understand require-dev will only pull dependencies for the root composer.json file (see this link).

How can I force one/all core/composer.json dependencies (including the required-dev ones) to be pulled if I want without hacking the root composer.json file e.g. with a composer require vendor/package?


texts: No menus being displayed in SideBar First

texts:
Im using my own Omega 3 sub-theme and a new superfish menu (I created) to be displayed in the Sidebar First section of each page...no big deal. The menu displays as needed in while Im admin, but the entire sidebar is gone when viewed as anonymous. Thinking it may be an issue with Superfish I disabled the new menu and added the standard navigation menu in its place...same issue.

I kept debugging and noticed a weird issue Ive never seen: no menus are working as blocks in the first sidebar. I can add a static block with simple text or content in it and the sidebar is displayed as needed, but never functions if a menu is the only content in the section.

Any ideas?

Thanks in advance.


texts: What is the expiration time of Email verification link?

texts:
When we use the "Require email verification" in account settings for creating new accounts, does the link have an expiration time or it will last forever?

If if never expires, is is possible to add an an expiration time, preferably using a contrib module?


texts: Ubercart - add comment pane text to order template

texts: In Ubercart pane settings I turned on comment pane (at admin/store/settings/checkout), that is displayed at checkout page. I'm also overriding default order template an I need to print the comment here. Is it possible to achieve that without modifying ubercart module?


texts: Using the fetch() method in database query to get an array

texts:
I have a very simple query that does the job, to get a collection of a specific content type's node id and title, that's it.

$connection = \Drupal::database();
$query = $connection->select('node_field_data', 'n');
$query->condition('n.type', 'employee');
$query->condition('n.status', 1);
$query->fields('n', ['nid', 'title']);
$results = $query->execute()->fetchAll();

And what i get is an array filled with objects (for each individual results) with two properties the nid and title values. But i want to have an single layer/dimension array filled with key => valued pairs (nid => title). Example bellow.

$results = [
  0 = {stdClass} (
     nid => 123,
     value => Susan Green
  )
];

And what i want:

$results = [
  123 => Susan Green,
  567 => Bob Young
];

I've tried fetchAllAssoc, fetchAssoc, etc but either the result is empty or i get something completely opposite of what i want.

Any ideas? without using a parses to convert objects into what i want, that's what i'll do if none one can find an appropriate answer.


texts: I'm starting to build a new Drupal site with the core theme "Stark" (Almost no styling) but I can't seem to find where the default body background(grey) is coming from so I can change it. (I'm good with CSS).


texts: Change part of theme according to time of day

texts:
In Drupal 8, I'm trying to change part of a twig template according to time of day.

For instance, if in one of my twig templates I have:

Where and what do I need to change to have it produce

according to server time?

I was thinking of doing it passing a variable to my twig template and then something like:

{{ if (variable == 'day') }}

{{ else }}

{{ endif }}

But I don't know how to pass a $variable to the template. Also, if I were to do this in a module, what hook would I have to alter to achieve this?

The idea would be to use PHP's date object to find out the current time to then change the value of a certain $variable in a hook, and said variable would be available to work in twig with in the above pseudo-syntax.

Can anyone share some pointers on where to begin?


texts: Count commerce orders by day and total in views

texts:
I have being trying to modify the default commerce orders view "admin/commerce/orders
" to do the following.

I want the output to list orders by date, number of products, tax and Total

Is this possible with views or do i need to look into a custom module? I cant get anything that is remotly close.
The best i can get is to count orders.


texts: Node or Taxonomy reference field with "Add new item" on node creation page

texts:
I would like to include an "Analyst" Reference field in a content type and allow users to create a new option without needing to leave the Add node page.  So it would be a drop-down with an "Add New Analyst" button.  So a pop-up or an iframe or something so the user doesn't have to leave the page to add a new option and then start over from scratch.

The "Analyst" could be a separate content type or even taxonomy term with multiple fields.

I would use Select (or other) module, but it doesn't support Node reference or taxonomy with multiple values.


texts:
I have page structures like:

example.com/aaa
example.com/aaa/a1
example.com/aaa/a2
example.com/bbb
example.com/bbb/b1
example.com/bbb/b2
example/com/ccc
........

What I need is instead example.com/xxx/x1, I want users to see xxx.example.com/x1

How can I achieve this with a rewrite rule? Or any other suggestions?

Subdomains module does not work for me because it doesnt allow custom subdomains.


texts: How to make anonymous session data private

texts: I am using this multi-step form example (https://www.sitepoint.com/how-to-build-multi-step-forms-in-drupal-8/ ) for the basis of an online employment application using Drupal 8.  All applicants are anonymous users.  The Private Tempstore seems to be private to a user, but not to a session.  If two applicants are applying simultaneously from separate computers, their information will overlap and one person's social security number will show up on the other person's computer.  Not good.  How do I make the Private Tempstore private to the session, not just the user?  I am fairly new to drupal and would appreciate any help.


texts: $user not updating and "Validation error, please try again." on form in block

texts:
I have a form that I am using in a block that was generating the error:

  Validation error, please try again. If this error persists, please contact the site administrator

Doing some research shows that it is to do with $session mismatches with the form token that cause this error.

Further to this I noticed that a default value I was using from the $user variable wasn't updating when I changed login.

Both of these together led me to the realisation that my block was being cached (confirmed by debugging and seeing that my form builder function was only being called after I cleared caches) so I changed caching of my block to 'BLOCK_NO_CACHE'.

I am still getting the error and my $user isn't updating. Any ideas?


texts: How to add class in current page link fields?

texts:
I have an unlimited number of button who are link fields. Like on photo down.
{{ loop.first ? field.element_attributes.addClass(green) }}

I use this in twig to add class green for first button.
Orange button is link of current page where I am. How to add orange class to that field in loop?

There is loop.first, loop.last, loop.index, loop.index0, loop.lenght..Is someone for current page?


texts:
I'm not using the Quiz module; I am using Webform and Drupal 7.

I have created a quiz that, if passed, assigns the user a new role. Currently, I use validation rules to simply prevent wrong answers from validating; all questions must be answered correctly before the user can proceed.

I need to change this to allow users with a score of 80% or higher to proceed to the next quiz. I know that I can do that with the quiz module. However I also need to be able to show correct answers for missed questions only to users who scored between 80% and 100%. Those scoring below 80% may not see any answer key.

What is the best way to go about this?


texts: How can I add external CSS using hook_css_alter?

texts:
I want to load an external CSS file using the hook_css_alter (so I can change the style dynamically based on domain name), but when I try to add items to $css, it often gives

Exception: Invalid CSS asset type. in Drupal\Core\Asset\CssCollectionRenderer->render() (line 72 of core/lib/Drupal/Core/Asset/CssCollectionRenderer.php).

(and warnings: Undefined index: media Undefined index: browsers)
function mymodule_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $assets)
{
    $nodeID = 3; // Pretend this dynamically changes
    $node = Node::load($nodeID);
    if ($node) {
        $css["nodeplain/{$node->nid[0]->value}/css"] = [
            'type' => 'file', // I think this line needs to change?
            'group' => CSS_AGGREGATE_DEFAULT,
            'weight' => 0,
            'media' => 'all',
            'browsers' => [],
            'preprocess' => false,
            'data' => "/nodeplain/{$node->nid[0]->value}/css",
            'version' => $node->revision_default[0]->value,
        ];
    }
}


texts: Apache Sorl Add Custom Term Indexing with Hierarchy

texts:
My project was have 3 content types with taxonomy, i need to combine all the content types term field values and display with hierarchy.
My fields are :
field_peoples_rits_term,
field_publcation_rits_dev,
field_research_rits_term
I Need combine all these fields as a new field. Thanks in advance


texts: Print stylesheets & overriding a base theme style sheet

texts:
Since adding a print style sheet and marking the screen stylesheets accordingly:

stylesheets[screen][] = css/example.css

rather than

stylesheets[all][] = css/example.css

The Genesis base themes are overriding the similarly named site styles in my sub theme. Specifically /sites/all/themes/genesis/genesis/css/layout.css is overriding my sub-theme layout.css file.

I've tried adding 'fake' calls to empty stylesheets (as per 'Overriding style sheets from modules and base themes'), with no success:

;----------// Modular Stylesheets

; Stop base overrides with fake file
; http://drupal.org/node/225125#comment-3028740
; http://drupal.org/node/263967
stylesheets[all][] = css/base.css
stylesheets[all][] = css/layout.css
stylesheets[all][] = css/blocks.css
stylesheets[all][] = css/comments.css
stylesheets[all][] = css/nodes.css
stylesheets[all][] = css/page.css
stylesheets[all][] = css/style.css

; block, comment, node, page and style CSS.
stylesheets[screen][] = css/blocks.css
stylesheets[screen][] = css/comments.css
stylesheets[screen][] = css/nodes.css
stylesheets[screen][] = css/page.css
stylesheets[screen][] = css/style.css
stylesheets[screen][] = css/layout.css
stylesheets[screen][] = css/forms.css
stylesheets[screen][] = css/rows.css

; Print css
stylesheets[print][] = css/print.css

I think the issue is that the later [screen] type is included as an extra stylesheet, rather than overriding the first [all]. But I can't see a way round it ....


texts: How do I programmatically change the body text format on the page content type to full HTML?

texts:
I have a custom install profile and I must programmatically change the body text format on the page content type to full HTML. However, I didn't manage to find how to do it.

How can I do it?


texts:
I want to select all the nodes from the database where a specific taxonomy term is defined (in Drupal 7).

I already know the taxonomy term (IDs). So I want to use a join to get the latest node thats created for that taxonomy.

For the moment I have this:

$query = db_select("node","n");
$query->join('taxonomy_index', 'i', 'n.nid = i.nid');
$query->fields("n",array('nid','title','created'))
        ->orderby("created","desc")
        ->range(0,1);

drupal_set_message($id);

$query->where('(i.tid = :type)', array(':type' => $id));

drupal_set_message($query);

$query->execute();

$array = array();
foreach ($query as $record) {
    $array[] = $record;
}
return $array;

This is (some of ) the output of the messages:

Id: 1

  SELECT n.nid AS nid, n.title AS title, n.created AS created FROM
  {node} n INNER JOIN {taxonomy_index} i ON n.nid = i.nid WHERE ((i.tid
  = :type)) ORDER BY created DESC LIMIT 1 OFFSET 0

If I use the following string directly in PHPMYADMIN, I have results:

  SELECT n.nid AS nid, n.title AS title, n.created AS created FROM
  drpl_node n INNER JOIN drpl_taxonomy_index i ON n.nid = i.nid WHERE
  ((i.tid = 1)) ORDER BY created DESC LIMIT 1 OFFSET 0

The result directly in Drupal returns an empty array.. What am I doing wrong?


texts:
I try to add an image in articles but the content filter won't save?
WHen you add content, article there is the content filters, like full html, or basic.
Each has the icons where you can add images. When I try, the page won't save.
I'm not sure why, is there a configuration setting To try?
I do get the image upload requester, and also I can see the image in the Text area, but when I save the image disappears.  When looking at the ftp, I can see the image did upload.
Thanks for any help with this.
Drupal says these files are public.
Public file base URL
https://digitaltreats.com/sites/default/files
The base URL that will be used for public file URLs. This can be changed in settings.php
File folder has 755 permissions.
I'm using the basic format, I made one also that unchecked the html limiter to test. This is what the html limiter allows: < img src alt data-entity-type data-entity-uuid data-align data-caption> This is what the ckeeditor img upload button adds. < img alt="text" data-entity-type="file" data-entity-uuid="393d" src="/sites/default/files/inline-images/gamingpc_2.jpg" /> is there a way to add  to the allowed html section? When I try to save the article it doesn't


texts: How to get total number of rows on a block of a view

texts:
On hook_block_view_alter() I need to get a total number of rows that this block displays.

For example, I have a view with the following block:

On hook_block_view_alter() I do the appropriate checks in order to weed out unnecessary blocks and get the one shown in the figure above.

function mymodule_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
  if (!preg_match('~^views_block:taxonomy_tag_list~', $block->getPluginId())) {
    return;
  }

  $view = $block->getViewExecutable();
  // Gets the number of rows
  $totalRows = $view->get_total_rows;
}

But for some reason, $totalRows contains NULL.

Here is the object of the current view:

Why can't I get the total number of rows? Maybe I'm using the wrong hook?


texts: Form with Site Content that Creates an Entity with User Created Content and Site Content Combined

texts:
Webform and EntityForm do not seem to have the ability to create entities.

Please help me find modules that can be used to build a Planning Form that creates User Created Planning Entities for the use case below. Any further tips or modules for the bonus features would also be greatly appreciated.

Minimally Viable Product:

At its core this is a way for Authenticated Users to plan for a conference. The user views videos, pictures and text then saves notes about the videos, pictures and text, and later accesses an entity they created with the original videos, pictures and text grouped with their user created content. So a video about networking at a conference has a form below it for the user to make notes they can see later and know it’s notes for that particular video.

Parameters:

Three Entity Types:

Conference Node  Content Type (that provides access to the Conference Planning Form)
Conference Planning Form (for viewing standard Drupal Fields and saving user created content)
User Created Conference Planning Entity (for future viewing and editing of Conference Planning Form site admin and user created content)

The user does not need to actually book the event through this feature. This feature is to help them stay organized.
If there is a way to have the user save their User Created Conference Planning Entity on the front end that would be great but not required.

Use Case:

User finds a Conference Node they are interested in.

User selects a button to plan for the conference and they are taken to a standard site wide Conference Planning Form.

The Conference Planning Form (hopefully an entity) contains instructions and tips created by the site admin (such as videos, pictures, links or text), and a form field the authenticated user can use to create notes (links and text) grouped with the field or a group of fields the site admin created  that display on the Conference Planning Form to generate a User Created Conference Planning Entity.

The authenticated user fills out the form fields they would like to use and saves the Conference Planning Form to create a User Created Conference Planning Entity  which is added to their list of User Created Conference Planning Entities.

Later the user can access the User Created Conference Planning Entity they created to add content to the form entry fields
The user can access the User Created Conference Planning Entity they have created to view notes they created.

Bonus Features:

After saving the Conference Planning Form and when viewing the User Created Conference Planning Entity the user created, the original content from the Conference Planning Form is displayed and grouped with each form field of content the user created the first time they saved Conference Planning Form and created the User Created Conference Planning Entity.
The ability to for the sited admin to provide site wide generic Conference Planning Form or a custom Conference Planning Form for any Conference Node.
The ability to automatically displays fields on the Conference Planning Form referencing the Conference Node the user came from with the referenced fields (possibly with Entity Reference module) grouped (possibly using Field Group module) with a form field the user could add notes to.
A site admin created task list that can be on the Conference Planning Form that would also show on the User Created Conference Planning Entity that could be checked off (possibly using the Flag Module.
The authenticated user can create a custom task lists on the User Created Conference Planning Entity that they can checked off.


texts: is the a module similar to data_export_import that includes user roles?

texts:
I am using the Data Export Import module to migrate data from my live site to my dev site.  It works fine in all cases except user roles.  For some reason, many (but sometimes not all) users lose the user roles that are assigned to them.  Is there a more advanced module that can handle an export-import of nodes and user (preserving node references and NIDs) which also migrates user roles?

If not, I am considering writing some rules to save and reset the roles as stated here:

Programmatically assign user role


texts:
Google doesn't see my SEO friendly URLs, while the other search engines can.

The browsers (IE, Chrome, FF), the RSS, the TweetFeed everything can see the SEO friendly URLs; in the XML sitemap, the system also see them.
Google Webmaster, and Google Analytics also see the friendly URLs, but if I search on my site via Google ("site:mywebsitedomain"), it can see only the node system URLs (e.g. mysite.com/node/6574).

Before the system update, it was working well. My host supports friendly URLs; I have installed the PathAuto, and the Global Redirect modules; clean URLs are enable.

Why doesn't Google see the SEO friendly URLs I set for the site?


texts: Using the subfolder module to extend domain access

texts:
I'm using the domain access module to create multiple sites based on unique subdomains.

For instance we have a subdomain1.url.com link to one front page and subdomain2.url.com linking to another.

I need however to be able to create multiple sites under one subdomain as well.
Not only do I need unique sites for subdomain1.url.com but I also need subsites such as subdomain1.url.com/subfolder1 and subdomain1.url.com/subfolder2

To attempt this I have used the Subfolders Domain Module. Viewable here https://www.drupal.org/project/subfolders_domain

I'm able to successfully create these subfolder domains however when attempting to access them I receive a 'File not found error' I've also tried creating basic pages and pointing it to the page but I still receive the same error.

I understand there are ways to accomplish this using .htaccess and such but I'd like to continue to use the domain access module since we are taking advantage of that to limit user privileges and content to specific domains.

Are there common issues that result in the 'File not found' error I found or is there another solution?


texts: Is it possible to disable a content type?

texts:
I am currently creating a small Drupal 7 website, but I don't plan to use the delivered Article content type. Is it possible to disable it without deleting it? What I mean by that is making sure no user will create articles by accident.

I could not find an option for this. Thanks.


texts: Multisites with different database share rules

texts:
I create two sites with same code and different databases, but when I activate rules in the second site I can see the first site's rules.

I can disable the rules in second site and keep them active in the first, but rules with automatic name (ex. "Email on User Restriction") only appear one time.

Its a problem of my configuration? registry_rebuild.php does not fix.


texts:
I have the content type 'machine' that uses two vocabularies (producer, category).
I would like to create node alias like [language]/machines/[producer-name]/[title-raw]; [producer-name] is from the vocabulary.

Could anybody give me any advice?


texts: How to switch from recommended release of module to dev release?

texts:
For example, I'm currently using the Geofield module.
I'm using version:

7.x-1.0-beta2 (2011-Nov-17)

Now I see the development version has some functionality that I want.  How do I correctly and safely "upgrade" to the development version of the module?

7.x-1.x-dev (2012-Jan-10)

What I currently do is, remove the geofield from any content types, disable the geofield module, uninstall the geofield module, physically delete the geofield module from my server, and then download and install the dev version.  This seems to work but I'm wondering if there is a more efficient workflow.

(I have drush installed so I'm open to a solution involving drush)


texts: Different number of decimals for prices and totals

texts:
I use Drupal Commerce and I have a problem with the number of decimals in prices. In Spain (and I suppose in other countries too), I could have prices of products with more than two decimals, but at the end, the totals are rounded to two decimals. With currency settings module I can set the number of decimals, but It is for all (prices and totals). Is there anyway I could have four decimals for prices and two for totals?
Thanks in advance.


texts: Views filter has taxonomy term in whole vocabulary

texts:
I'm trying to use the "has taxonomy term" filter in a view together with Views Populate filters (https://drupal.org/project/views_filters_populate).

The taxonomy filter has not to be exposed because the exposed filter is the one created with Populate filters.

The site admin continuosly add new term to the vocabulary.

Consequently I cannot fill the "is one of" setting for the "has taxonomy term" filter.

I would need some settings like: if the term is in the vocabulary.

Any idea?

It seems strange to me that you cannot use the same input field to search for example in title and in a term reference field.

thank you in advance


texts: How include hash (#) in drupal_goto path?

texts:
Is there any way to include a # in drupal_goto?

i want something like this

function MYMODULE_preprocess_node(&$variables) {
  $node = $variables['node'];
  switch ($node->type) {
    case 'product':
      drupal_goto("products#".$node->nid);
  }
}


texts: Changing the image path after images were uploaded

texts:
I have created a image field under a custom Content Type and let the file directory setting to default, meaning the files are not uploaded to any sub directory.

As I can see now this is not a suitable situation for me and I would like to save the files in a sub directory. If I change the File Directory setting under the Field Settings will this break the paths of the files uploaded prior?

Thanks


texts: Modal Popup in IE submit button does not work

texts:
We are using the Ctools modal popup for registration.  In every other browser, this works.

In IE8 and IE9, after filling out the popup form, when a user presses "Create Account", the form disappears, and then pops back with all the fields empty.  In other browsers, it reroutes to the registration page.

I tried debugging in F12 developer tools but I'm not sure where to look.


texts: how to render html link within dsm message?

texts:
I would like to include a link to the reports page within a dsm message.  Here is what I tried:

  $loglink = l("logs", 'admin/reports/dblog');
  $msg= "See $loglink for watchdog messages";
  dsm ($msg);

However, this displays the raw html (a href=...) and does not render the link.

How do I render the html link within a dsm message?  (I am using Drupal 6.x)


texts: How do I trigger an AJAX submit button on page load?

texts:
I am attempting to trigger a form (to get live data) on a page load. So far, I have this code I have found from bits and pieces and digging around the net, but unfortunately not a lot of people actually appear to have needed to do this.

jQuery(document).ready(function($) {
  var element_settings = {};
  var element = {};
  element_settings.progress = { 'type' : 'throbber' };
  element_settings.submit = { js: true };
  var ajax = new Drupal.ajax($('#edit-ratessubmit'), element, element_settings);
  element.form.clk = element;

  ajax.form.ajaxSubmit(ajax.options);
});

This currently complains that element_settings doesn't contain a URL, but when it does contain a URL, I get some random "b is undefined" error.


texts: How to show 404 page for not found images

texts:
If I request an image that doesn't exist like mysite.com/test/test_not_found_image.jpg, I get a Not Found white page just like this page: https://www.drupal.org/files/testing_404.jpg.

Is it possible to have Drupal show the styled 404 page that I have instead of that white 404 page?


texts: Can't login to Drupal after Varnish install (reverse proxy)

texts:
I setup Varnish for Drupal 7.x; when I go to settings.php to uncomment the following line, and I try to login as administrator, I am just redirected to the same page; nothing happens. No idea what could I have done wrong.

$conf['reverse_proxy'] = TRUE;


texts: Extract info from profile insert into node creation

texts:
Hey Guys I hope you can help!

In short: User Profile fields should be exported to certain parts of the add new page fields, Text and Taxonomy Terms

For example, User profile will have 2 html codes for pictures and 3 taxonomy terms or just the text and these fields need to be filled in automatically inside node creation so the user doesn't need to do this and all goes well. User should not be able to edit or change it as well.

I don't want users to fill in the following things on node creation since it only makes things complicated for them. But it needs to be different for each user and it needs to be done for every node or else things will get displayed on the wrong pages. So I want to set it up once and then it will be automatically filled in the rest of the times. I think its easiest to have this information stored in the user profile which they get after I create the account for them. They don't need to see this and Drupal should pull in the information from the user profile. But how

text field which will need an image html code which is the same for every node of this user displays a small image for the view that shows up in the panel. (so its needs to be filled every single time with an image link)
text field which will need an image html code which is the same for every node of this user but this one display a bigger image for the node. (so its needs to be filled every single time with an image link)
Taxonomy Term 1.
Taxonomy Term 2.
Taxonomy Term 3.
Text user can fill in
Another text a user can fill in.
Date field a user needs to fill in.


texts: Page not found when visiting an Ubercart google_checkout URL

texts:
When I visit mysite.com/google_checkout?serial-number=123-456-7, I get

  The requested page "/google_checkout?serial-number=123-456-7" could not be found.

Otherwise, then I have a working Google Checkout button on my site and everything seems to be configured. How can I get the callback URL to work?


texts: content field user reference populated by view (views2)?

texts:
Drupal-6.22

I have numerous content types where one or more users are associated with the type.  On the bottom of the field definition page there is an advanced section where it asks for the name of the view to provide the content.  I've created a view but it is not showing in the drop down in this area. What does one have to do in order to make a view available for this content field drop down?

The field area reads: Advanced - Users that can be referenced (View)

Please provide a URL where this is explained?

Thanks


texts:
I'm trying to change the width of an input field in on a views exposed filter where the exposed filters are exposed as block, currently the default adds the width property set to 30 and I need to remove that so that it scales correctly in many parts of the site. I have tried the following function in my template file and it outputs the variables using dsm with the width property missing as I would expect it just doesn't render it properly.

function MYTHEME_preprocess_MYVIEW(&$vars, $hook) {
  if ($vars['form']['#id'] == 'MYVIEW') {
    unset($vars['form']['MYFIELD']['#size']);
    dsm($vars);
  }
}

I don't want to use a css hack!


texts: How can I have a block show only on the /user page, but only for users with specific role?

texts: I have users with the role "authors" and a block in /user showing publications so that visitors can see the publications of every "author". The problem is that the block is showing at every user profile page even if the user has not an "author" role. How can i set this block to show only to user profile pages that have a role "author"?


texts: How to get the Date, when particular field of a node is equal to some value?

texts:
I have Content type called "Items", in that i have select list field for status referencing to Taxonomy terms(delivered,hold,dispatched etc.) .
 I want to store the date in some custom table when the item is "dispatched" and use that date in some other code.
 Which is function in which i can write logic to store date in table?  or any other way i can get dispatched date of the item?


texts: use taxonomy term for reservations how to prevent overlapping

texts: I have a drupal site where reservations are available. We use fullcalendar module to visualize the room reservations. For a reservation the user needs to add a new content. The content uses taxonomy terms as rooms. Now I'd like to achive that once the user creates a new booking content and chooses the room, when it is not available, the user should be warned. I mostly use rules and i am a bit unexperienced with drupal, now I'm trying to learn.


texts:
I am working with a site which uses many different languages. When switching languages there is always one main menu item which doesn't translate, but the title on the page it links to does translate (menu title and page title are both the same).

The main menu mostly consists of a number of links to taxonomy terms, but this single troublesome link is to a node.

What is going wrong here?


texts: Is it possible to select a row with tableselect.js?

texts:
Drupal includes tableselect.js in a view I am using that uses views bulk operations.  I am wondering if it is possible to use the table select code to select a row by id or some other selector.  My goal is for the select all checkbox to get checked if all rows are selected.

Here is the tableselect code:

Drupal.behaviors.tableSelect = function (context) {
  $('form table:has(th.select-all):not(.tableSelect-processed)', context).each(Drupal.tableSelect);
};

Drupal.tableSelect = function() {
  // Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
  if ($('td input:checkbox', this).size() == 0) {
    return;
  }

  // Keep track of the table, which checkbox is checked and alias the settings.
  var table = this, checkboxes, lastChecked;
  var strings = { 'selectAll': Drupal.t('Select all rows in this table'), 'selectNone': Drupal.t('Deselect all rows in this table') };
  var updateSelectAll = function(state) {
    $('th.select-all input:checkbox', table).each(function() {
      $(this).attr('title', state ? strings.selectNone : strings.selectAll);
      this.checked = state;
    });
  };

  // Find all <th> with class select-all, and insert the check all checkbox.
  $('th.select-all', table).prepend($('<input type="checkbox" class="form-checkbox" />').attr('title', strings.selectAll)).click(function(event) {
    if ($(event.target).is('input:checkbox')) {
      // Loop through all checkboxes and set their state to the select all checkbox' state.
      checkboxes.each(function() {
        this.checked = event.target.checked;
        // Either add or remove the selected class based on the state of the check all checkbox.
        $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');
      });
      // Update the title and the state of the check all box.
      updateSelectAll(event.target.checked);
    }
  });

  // For each of the checkboxes within the table.
  checkboxes = $('td input:checkbox', table).click(function(e) {
    // Either add or remove the selected class based on the state of the check all checkbox.
    $(this).parents('tr:first')[ this.checked ? 'addClass' : 'removeClass' ]('selected');

    // If this is a shift click, we need to highlight everything in the range.
    // Also make sure that we are actually checking checkboxes over a range and
    // that a checkbox has been checked or unchecked before.
    if (e.shiftKey && lastChecked && lastChecked != e.target) {
      // We use the checkbox's parent TR to do our range searching.
      Drupal.tableSelectRange($(e.target).parents('tr')[0], $(lastChecked).parents('tr')[0], e.target.checked);
    }

    // If all checkboxes are checked, make sure the select-all one is checked too, otherwise keep unchecked.
    updateSelectAll((checkboxes.length == $(checkboxes).filter(':checked').length));

    // Keep track of the last checked checkbox.
    lastChecked = e.target;
  });
  $(this).addClass('tableSelect-processed');
};

Drupal.tableSelectRange = function(from, to, state) {
  // We determine the looping mode based on the the order of from and to.
  var mode = from.rowIndex > to.rowIndex ? 'previousSibling' : 'nextSibling';

  // Traverse through the sibling nodes.
  for (var i = from[mode]; i; i = i[mode]) {
    // Make sure that we're only dealing with elements.
    if (i.nodeType != 1) {
      continue;
    }

    // Either add or remove the selected class based on the state of the target checkbox.
    $(i)[ state ? 'addClass' : 'removeClass' ]('selected');
    $('input:checkbox', i).each(function() {
      this.checked = state;
    });

    if (to.nodeType) {
      // If we are at the end of the range, stop.
      if (i == to) {
        break;
      }
    }
    // A faster alternative to doing $(i).filter(to).length.
    else if (jQuery.filter(to, [i]).r.length) {
      break;
    }
  }
};


texts: Where can I find the upcoming DrupalCamps and DrupalCon?

texts: Where can I find the upcoming DrupalCamps and DrupalCon ? I'm not aware of any website that contain information about  upcoming DrupalCamps and DrupalCon other than social media. I think will be nice if I can have a page where I can see upcoming DrupalCamps and DrupalCon.


texts: Views and Field Collection: Merge duplicates

texts:
I have a content type "Person" which has a field collection field "Skills". Each skill has a name and 2 other fields. Each Person can have multiple skills. I want to view each Person, with their Skill names diplayed separated with commas like this:

John Doe: Architecture, Light Technology
Jane Doe: Biology, Energy, Computer Science

Currently, I have a relationship to the field collection that enables me to display the fields used in "Skills". The problem is, if a Person has multiple Skills, one row is displayed for each Skill, so some Persons are displayed multiple times:

John Doe: Architecture
John Doe: Light Technology
Jane Doe: Biology
Jane Doe: Energy
Jane Doe: Computer Science

How would I go about "merging" these fields?


texts:
How can I change "Default comments per page" array to my own. What hook I need to use, if it needed?
hook_form_FORM_ID_alter(&$form, &$form_state)
with FORM_ID = node_type_form

$form doesn't contain this value


texts: Drupal Commerce Shopping Cart Form Alter

texts:
I'm trying to use hook_form_FORM_ID_alter() in my theme's template.php file to change the 'Remove' button in the Commerce add to cart form to an image button. To do this I'm using the following code:

function tempestra_form_views_form_commerce_cart_form_default_alter(&$form, &$form_state) {
  foreach($form['edit_delete'] as $item) {
    if($item['#type'] == 'submit') {
      $item['#type'] = 'image_button';
      $item['#src'] = base_path() . drupal_get_path('theme', 'tempestra') . '/images/search.png';
      unset($item['#name']);
      dpm($item);
    }
  }
}

When I look in the array printed by dpm() everything is as it should be, however the HTML for the image button isn't printed.

Thanks in advance.


texts: How and where do I programmatically add a menu to the Navigation menu?

texts:
I want to add menu items to the Navigation menu dynamically, depending on certain states (example: user is logged in, etc). I assume I do this in theme_preprocess, but I can't seem to find the var to tweak.

Am I looking in the wrong place? Where is the best place to do this, and what is the best method?


texts: How to remove images from body field in views?

texts:
In the body field of a content type, I have added an image at the start. In my view, I want to show 200 characters from the body field. It also prints the image.
How can I skip the photos from the body field in the view, and print just the text?


texts: Product Reference inside a Product Reference?

texts:
In my attempt to solve a "variation can update second variation" issue, I am wondering if a Product reference can go inside another Product Reference?

So that the 'Variation' itself has a product reference inline form to another type of variation? ( I have tried and nothing shows up).

The idea is that loading 1 variation will then load the referenced product variations therein and combine the 2 to create the final price.

(This is a case where the 2nd variations price is based on what is selected in the 1st variation.)


texts: Is there any module or options to allow site users to follow or unfollow the taxonomy terms?Basing on the following terms, I have to send a notification if any new post has been created on those particular terms.


texts: A better anti-spam solution for Drupal 7?

texts:
I have Mollom and HoneyPot set up and working. I tried various Captcha modules with images, etc. I even put a question field in the registration form using Mollom and HoneyPot. Although the answer isn't included anywhere in the page, spam bots still manage to register, activate, and post spam!

Could you recommend a better solution than what I have, to stop the spam?


texts: How to alter a form depending how it was accessed

texts:
I would like to alter the login form depending how it was accessed. As an example, if the form was access from a particular link, it would display the standard login form. If it was accessed from a different link, then the login form would be modified (ie maybe display a different title and exhibit different behaviour (redirects based on role)).

I figure I need to use hook_form_alter() but I am not sure how to tell which link was clicked. Any ideas how one would go about accomplishing this? I am working with Drupal 6 by the way.

Thanks


texts: REST Post creating entities with relations

texts:
I am having trouble creating comments on nodes ( articles etc. ) with the Rest module.

I have enabled the endpoint in rest.settings.yml :

resources:
  'entity:node':
    GET:
      supported_formats:
        - hal_json
        - json
      supported_auth:
        - cookie
    POST:
      supported_formats:
        - hal_json
        - json
      supported_auth:
        - basic_auth
  'entity:comment':
    GET:
      supported_formats:
        - hal_json
        - json
      supported_auth:
        - cookie
    POST:
      supported_formats:
        - hal_json
        - json
      supported_auth:
        - basic_auth

I have followed the information here rest tutorial - headless drupal 8 and on drupal.org
I used this tutorial as a base to build my request, noting that there have been changes since the article was posted.

I am using basic_auth, setting the CSRF token as per issue and I have set permissions for the test user to edit, delete and create articles, basic pages and comments.

I am using application/json+hal because of the outstanding issue
with application/json

What is happening is the server is reponding :

403 Forbidden :
{"error":"Access denied on creating field entity_id"}

The request is failing where checking access on read only fields, which return AccessResult::forbidden();

Clearly I am missing something from my request ? I thought that the hal _links reference points to the entity_id ?

My request so far :

{
   "_links":{
      "type":{
         "href":"http://d8.dev/rest/type/comment/comment"
      },
      "http://d8.dev/rest/relation/comment/comment/entity_id":[
         {
            "href":"http://d8.dev/node/1?_format=hal_json"
         }
      ],
      "http://d8.dev/rest/relation/comment/comment/uid":[
         {
            "href":"http://d8.dev/user/1?_format=hal_json",
            "lang":"en"
         }
      ]
   },
   "_embedded":{
      "http://d8.dev/rest/relation/comment/comment/entity_id":[
         {
            "_links":{
               "self":{
                  "href":"http://d8.dev/node/1?_format=hal_json"
               },
               "type":{
                  "href":"http://d8.dev/rest/type/node/article"
               }
            },
            "uuid":[
               {
                  "value":"c4b5b929-3ccb-4cfd-8200-0ec8f9170926"
               }
            ]
         }
      ],
      "http://d8.dev/rest/relation/comment/comment/uid":[
         {
            "_links":{
               "self":{
                  "href":"http://d8.dev/user/1?_format=hal_json"
               },
               "type":{
                  "href":"http://d8.dev/rest/type/user/user"
               }
            },
            "uuid":[
               {
                  "value":"76555fc7-c4c4-4e1f-a053-83ab818bba4f"
               }
            ],
            "lang":"en"
         }
      ]
   },
   "comment_type":[
      {
         "target_id":"comment"
      }
   ],
   "comment_body":[
      {
         "value":"Hello world this is a comment",
         "format":"basic_html"
      }
   ],
   "subject":[
      {
         "value":"A comment test"
      }
   ],
   "name":[
      {
         "value":"admin"
      }
   ],
   "thread":[
      {
         "value":"01/"
      }
   ],
   "entity_type":[
      {
         "value":"node"
      }
   ],
  "field_name": [
    {
      "value": "comment"
    }
  ]
}


texts:
On 6th January, I updated my Drupal 8 development system (composer update). The following ls listing shows the modules that were updated.

drwxr-xr-x  7 drupal8 www-data 4096 Jan  6 02:36 checklistapi
drwxr-xr-x  7 drupal8 www-data 4096 Jan  6 02:36 ctools
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:36 quick_node_clone
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:36 workbench_access
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:36 file_checker
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:36 eva
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:36 social_post_linkedin
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:36 term_csv_tree_import
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:35 memcache
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:35 feeds
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:35 easy_breadcrumb
drwxr-xr-x  7 drupal8 www-data 4096 Jan  6 02:35 fontawesome
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:34 term_csv_export_import
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:34 leaflet_more_maps
drwxr-xr-x 11 drupal8 www-data 4096 Jan  6 02:34 devel
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:34 typed_data
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:34 externalauth
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:34 libraries
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:34 social_post_twitter
drwxr-xr-x  4 drupal8 www-data 4096 Jan  6 02:34 auto_entitylabel
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:33 contentimport
drwxr-xr-x 11 drupal8 www-data 4096 Jan  6 02:33 paragraphs
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:33 telephone_validation
drwxr-xr-x  9 drupal8 www-data 4096 Jan  6 02:32 leaflet
drwxr-xr-x  9 drupal8 www-data 4096 Jan  6 02:32 entity_browser
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:32 workflow
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:32 config_update
drwxr-xr-x  5 drupal8 www-data 4096 Jan  6 02:32 entity
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:32 workbench
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:32 unique_field
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:32 entity_reference_display
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:31 ledger
drwxr-xr-x  8 drupal8 www-data 4096 Jan  6 02:31 eu_cookie_compliance
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:31 social_api
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:31 permissions_filter
drwxr-xr-x  3 drupal8 www-data 4096 Jan  6 02:30 social_post
drwxr-xr-x  6 drupal8 www-data 4096 Jan  6 02:30 gdpr_compliance

I then went to bed and carried on working at around 14:20. Since that time I have regular errors of the following kind in my php7.2-fpm.log:

[06-Jan-2019 14:37:21] WARNING: [pool www] child 1263 said into stderr: "There was a problem sending 4325 bytes on socket 5: Broken pipe"
[06-Jan-2019 14:37:22] WARNING: [pool www] child 1263 said into stderr: "There was a problem sending 178 bytes on socket 5: Broken pipe"
[06-Jan-2019 14:40:23] WARNING: [pool www] child 1232 said into stderr: "There was a problem sending 178 bytes on socket 5: Broken pipe"
[06-Jan-2019 14:43:55] WARNING: [pool www] child 6461 said into stderr: "There was a problem sending 178 bytes on socket 5: Broken pipe"

I have only just noticed this now whilst in pursuit of another problem. Does anyone know what might be causing it?

I'm running Drupal 8.6 on Ubuntu 18.04 with Nginx 1.14.0 and PHP 7.2.10 with FPM. The database is Postgresql 10.6.

I thought originally it might be a hardware problem, but the the immediacy of the problem after the Drupal update seems too obvious to ignore.


texts:
I need to implement hook_entity_bundle_info(), and I noticed that the documentation includes a link to Finalize API for creating, overriding, and altering code-defined bundle fields. In short, that issue says that is wrong to use the BaseFieldDefinition class because that class marks the field as a base field, which is not true, since the field is being added to a bundle.

Can the BaseFieldOverride class be used to implement hook_entity_bundle_info()?

Doing so, the example given for hook_entity_bundle_info() would become the following one.

function hook_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
  // Add a property only to nodes of the 'article' bundle.
  if ($entity_type->id() == 'node' && $bundle == 'article') {
    $fields = [];
    $base_field_definition = BaseFieldDefinition::create('string')
      ->setLabel(t('More text'))
      ->setComputed(TRUE)
      ->setClass('\Drupal\mymodule\EntityComputedMoreText');
    $fields['mymodule_text_more'] = BaseFieldOverride::createFromBaseFieldDefinition($base_field_definition, $bundle);
    return $fields;
  }
}


texts: How to override specific row classes in a view preprocess function

texts:
Have tried the following but it does not work

function THEMENAME_preprocess_views_view_unformatted(&$vars){
  $view = $vars['view'];
  if($view->name == "videos" && $view->current_display == "block_2"){
    $vars["rows"][0]["attributes"]["class"] = array_merge($vars["rows"][0]["attributes"]["class"],['testclass']);
  }
}


texts: EntityQuery with fieldcondition of link field

texts:
I have a field called field_url which is of type link. I want to query and fetch all those nodes which have field_url value like eg. www.google.com. I tried using the below code:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'websites')
  ->fieldCondition('field_url','value','%google%','like');
  $result = $query->execute();

I get database error with this. I saw the values stored in field_data_field_url table and they look like serialized. What is the correct way of doing this?


texts: Drupal commerce auto login during checkout

texts:
I have e-commerce site, during checkout process it automatically create account for anonymous user. I have added following two rules to achieve this Assign an anonymous order to a pre-existing user and Create a new account for an anonymous order. What I want is instead of creating account i want the user to automatically login during checkout

I have tried Commerce Checkout Complete Registration, but I am facing some error, when user enter the email address and moves to next page
the site goes maintenance mode. When I checked the dblog it throws the exception

EntityMetadataWrapperException: Unable to set the data property uid as the parent data structure is not set. in EntityStructureWrapper->setProperty() (line 473 of /home/knackforge/Public/dropts/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

When i refresh the page user is automatically logged in.
 Is there any way resolve this error. Thank you


texts: Fatal Error Running Drush 4.4 with Drupal 7.2

texts:
Do you have any idea on what might be causing this error in Drush w/ Drupal 7.2 (worked fine in Drupal 7.0)?

  Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc on line 42
  Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
      Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc, line 42

Line 42 of database.inc contains the following line:

PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,

I thought this was related to PDO extension missing, but it is indeed installed.

Here is the output of drush -v -d status:

  drush -d -v status
      Bootstrap to phase 0. [0.03 sec, 1.28 MB]                            [bootstrap]
      Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 1.41 MB] [bootstrap]
      Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.07 sec, 3.18 MB] [bootstrap]
      Initialized Drupal 7.2 root directory at /path/to [0.09 sec, 4.06 MB] [notice]
      Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.09 sec, 4.06 MB] [bootstrap]
      Initialized Drupal site default at sites/default [0.09 sec, 4.06 MB] [notice]
      Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.09 sec, 4.06 MB] [bootstrap]

Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc on line 42
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /path/to/includes/database/mysql/database.inc, line 42 [0.1 sec, 4.56 MB]

EDIT:

phpinfo indicates that pdo, pdo_mysql are all installed. However, when I run

pecl remote-info pdo (and pdo-mysql), I get a (among others):

  Installed   - no -

So it appears that via the web requests, the extensions appear as installed, but not from the command line (same instance of php, v5.3). Is there a way to tell pecl what phpinfo already knows ... ?


texts: How do I display the file size and format of attachments on a node templates?

texts:
In the node template I output the attached files (multiupload file field). Need to output the size and format of each file. I do it like this:
{% for file in node.field_news_files %}Size {{ file.entity.filesize.value }} in {{ file.entity.filemime.value }} format{% endfor %}

I get this result: Size 2227507 in APPLICATION/PDF format
The goal is to get this result: Size 2MB in PDF format
Can I output the data as I need in the node template or do I need to redefine it file-link.html.twig?


texts: Create categories with their own teasers and sliders

texts:
I'm new to Drupal. First look at my site's structure:

Homepage

slideshow carousel - displays only selected nodes from the whole website
menu - displays links from a menu created for homepage
teaser - currently displays "promote to front page" items
footer - common to all pages (may be menu or site map)

Category

slideshow carousel - displays selected nodes only from current category
menu - displays links from a menu or subcategories with their nodes
teaser - selected nodes only from current category
footer - common to all pages (may be menu or site map)

Article

no slideshow
no menu
path to article (category breadcumb)
article title and body
footer - common to all pages (may be menu or site map)

How to divide website into categories as mentioned above?

Which modules to use? By default Drupal has Taxonomy module. Is it enough?

The simpliest way is to create custom templates like html--front.tpl.php, html--node--17.tpl.php, html--taxonomy--term--4.tpl.php, etc. but it's not flexible way. If you want to add more categories, you have to prepare another .tpl.php template.

What's the best and simple way to achieve this functionality?

More explanation:

Slideshow carousel is currently Slideshow:View module that displays all nodes with custom boolean field "promote to slider". Teaser on homepage works but I have no idea how to display it on category pages and even how to implement categories in Drupal. Any idea?


texts: Print module and wkhtmltopdf - How to install on linux centos shared hosting

texts:
I use The Print 7.2.x module and want to work with The wkhtmltopdf library.
I downloaded library files from this address: https://github.com/wkhtmltopdf/wkhtmltopdf  (this comment adviced to download this version from git )
and extract downloaded folder on sites/all/libraries.
I enable the wkhtmltopdf handler module and go to configuration pdf of print module . see these files for choose :

wkhtmltopdf
(sites/all/libraries/wkhtmltopdf-master/docs/usage/wkhtmltopdf.txt)

wkhtmltopdf
(sites/all/libraries/wkhtmltopdf-master/src/pdf/wkhtmltopdf.cc)

wkhtmltopdf (sites/all/libraries/wkhtmltopdf-master/wkhtmltopdf.qrc)

wkhtmltopdf (sites/all/libraries/wkhtmltopdf-master/wkhtmltopdf.pro)

when select one of these and go to status page recieved this error on status report:

Unsupported wkhtmltopdf version -
The currently selected version of
wkhtmltopdf () is not supported. Please update to a newer version.

I read several article about installation of this library but in those articles use command line . I can't understand how i can install this library and pdf generator on my drupal site.where is my require file library?
My host is linux centos 64bit - 6.x
I use cpanel.
and I am admin of server and have access to ssh.
Please help me. THank you beforehand.


texts: Load required libraries with content using ajax

texts:
So I created a form and and attached a Drupal library to it. From there I created a route that uses that form. Last a added a link that uses ajax to render that form.

For some reason when I look at the context that is rendered from that ajax request the /core/misc/vertical-tabs.js?v=8.2.6 gets loaded onto the page along with the form content, but my attached custom library does not.

If I visit the page without using the ajax request both the /core/misc/vertical-tabs.js?v=8.2.6 and my custom library load fine.

How can I get my custom library to load with ajax?


texts: Issues trying to understand and debug simplesamlphp error

texts:
Simplesamlphp used to work on the site. Something changed and now it does not.

The IDP remote config has been verified, including the cert
The SP cert and pem in the simplesamlphp/config folder have been verified
All the required settings show green on the admin page
When the ACS URL is entered as a test, a JSON file with the metadata is downloaded

All there seems correct. But when a user attempts to login, the following is thrown into the log file. I note that despite the entry about the candidate having :443, the URL with or without the port results in identical json.
This is Drupal 8.9.6, PHP 7.3.21, simplesamlphp_auth 8.x-3.2, simplesamlphp 1.18.8

simplesamlphp ERROR [ffdf5e0102] SimpleSAML\Error\Error: UNHANDLEDEXCEPTION
simplesamlphp ERROR [ffdf5e0102] Backtrace:
simplesamlphp ERROR [ffdf5e0102] 1 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/www/_include.php:17 (SimpleSAML_exception_handler)
simplesamlphp ERROR [ffdf5e0102] 0 [builtin] (N/A)
simplesamlphp ERROR [ffdf5e0102] Caused by: SimpleSAML\Error\Exception: > This SP [https://admin.mysite.gov/simplesaml/module.php/saml/sp/metadata.php/default-sp]  is not a valid audience for the assertion. Candidates were: [https://admin.mysite.gov:443/simplesaml/module.php/saml/sp/metadata.php/default-sp]
simplesamlphp ERROR [ffdf5e0102] Backtrace:
simplesamlphp ERROR [ffdf5e0102] 4 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Message.php:718 (SimpleSAML\Module\saml\Message::processAssertion)
simplesamlphp ERROR [ffdf5e0102] 3 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Message.php:640 (SimpleSAML\Module\saml\Message::processResponse)
simplesamlphp ERROR [ffdf5e0102] 2 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/modules/saml/www/sp/saml2-acs.php:141 (require)
simplesamlphp ERROR [ffdf5e0102] 1 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/Module.php:260 (SimpleSAML\Module::process)
simplesamlphp ERROR [ffdf5e0102] 0 /mnt/www/html/mysite/vendor/simplesamlphp/simplesamlphp/www/module.php:10 (N/A)
simplesamlphp ERROR [ffdf5e0102] Error report with id 86f8550b generated.


texts: Help with $base URL path in settings.php

texts:
Since I created my site (long time ago!) I have added content and changed many settings. My URL has always been www.domain.com/'drupalfolder'/(content)

I want to remove the drupal folder from the URL and just have my domain name (www.domain.com/content)

I have moved (manually) all the contents of the drupal folder on the 'public' folder but when I try and log in I get not found page or access denied.
I have tried to clear the caches before and after but still nothing. I had to change the main menu urls manually... I want all the URLs to change automatically!

Am I doing it properly? is there a process I can follow to save me time?

UPDATE: I do not have access to the .htaccess file as only my host has access to it ---- I am using cPanel


texts: How to configure a different main menu for each language on a multilingual site?

texts:
I have set up multilingual options on my site, and have a lot of pages in two languages.

I can't work out how to have a different main menu for the two languages. Under Structure->Menu->Settings, it says "Source for the Main links", and I'm adding all menu links to the "Main menu" there. However, this means I just get one big menu with all the items in both languages.

What I want is when the page is in English, the main menu is in English, and when in Chinese, the main menu is in Chinese. How to set that up?