Latest Drupal related questions

Score: -2
Ruzanna Hovasapyan avatar
Diff module shows 'No visible changes' for 'Geolocation' and 'International phone' fields
cn flag

I have "No visible changes" message for 'Geolocation' and 'International phone' fields change and have only one option "Don't compare" in Diff field configuration page /admin/config/content/diff/fields.

Can you help me fix this issue?

Score: 3
How to get all search results of search api index?
kr flag

I want to get all the search results from the search API index and then perform a custom sort on it and then display them accordingly.

I used the hook_search_api_results_alter and also the search results event. My view has a pager to display 10 results at a time.

But the problem is, I am only getting 10 results instead of all because of that pager.

Is there any to get all the results and then perfor ...

Score: 1
Joost avatar
PHP Fatal error: Uncaught ArgumentCountError on Drush run
jp flag

After I updated my site to Drupal 8.9.16 and Drush to 10.5.0 I get the following error PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function when running any Drush command. This only happens on my remote site not on my local site.

The site is still working ok so I was able to clear cache and update the database from the backend of Drupal. I was hoping this would fix the problem bu ...

Score: 0
How can I test code that uses cron for scheduling?
cn flag

I have some custom code on my site that schedules emails to be sent. When an email is set, a user account field is updated. So I want to write a test that:

  1. Jumps forward in time into the future
  2. Runs cron
  3. Checks the value of the email field
  4. Jumps forward in time into the future (and repeats 1-3)

Generally, to advance time in my tests, I'm using the Datetime Testing module, but this doesn't work ...

Score: 0
Grouping in Views jumbles row numbers returned by Result Counter
in flag

Grouping in a View is being used to show a list of items in a table, each row is numbered using Result Counter. However, the View uses grouping which causes the results to be jumbled. See enclosed image.

Any ideas how to renumber the rows correctly, also is there a way list the row numbers in reverse order.

Row numbers from Result Counter are jumbled when Views uses grouping

Score: 0
Berry Dingle avatar
Output of Twig truncated field value sanitezes punctuation characters
cn flag

I output the text of a field in a twig template truncated to 160 characters like:

{% set text = content.field_text.0|render|striptags %}
{{ text|length > 160 ? text|slice(0, 160) ~ '...' : text }}

But when a user enters quotations marks, ampersand and other punctuation characters, they are rendered as

" or &. 

Is there a way to "unsantize" these again, so they are put out the rig ...

Score: 0
dca123 avatar
Warnings after upgrading
cn flag

After upgrading to Drupal 9.2.0 using Composer I sometime get the following error.

Deprecated function: Required parameter $bubbleable_metadata follows optional parameter $data in require_once() (line 276 of core/lib/Drupal/Core/Extension/ModuleHandler.php). require_once() (Line: 276)
Drupal\Core\Extension\ModuleHandler->loadInclude('token', 'inc', 'token.tokens') (Line: 214)
token_module_imp ...

Score: 0
Matt avatar
Syntax for adding content inside group in Gutenberg json template
cn flag

I'm using Gutenberg on Drupal 9. When editing the Gutenberg JSON template for a content type I'm able to add placeholder headings and groups like so

[
["core/heading",{"placeholder":"Title Goes Here"}],
["core/group",{}]
]

However I want to put placeholder content inside the 'core/group' component. I've tried several variations including the following

["core/group",{'placeholder':'<h2>Headi ...
Score: 0
Filter on PHP value
us flag

I created a PHP value for a view to calculate the number of days between two dates. These dates range from negative values (-303) to positive values (422). This field is referenced as $row->php.

I'm trying to filter on those PHP value field for all values greater than 0. I can't seem to get it to work.

This is the code I am using so far.

$value = $data->php['0']['raw']['value'];
$num = (int)$value ...
Score: 0
cocq avatar
save a selection from an ajaxified field
gb flag

I successfully update a field from ajax. Its declaration is the following :

$form['field_unite_de_recherche']['widget']['#ajax'] = array(
  'callback' => 'ajax_equipes_from_unites_callback',
  'event' => 'change',
  'method' => 'html',
  'wrapper' => 'edit-field-equipe-membre2-wrapper',
);

This ajaxified field is declared as in the following :

$form['field_equipe_membre2'] = [
  '#typ ...
Score: 0
Extect avatar
How to deal with config changes in prod and by multiple developers?
cn flag

I have two scenarios in configuration management that I am unsure how to deal with:

  1. Geeky user makes config changes in production. What is the best practice to import these changes in dev without destroying the work that is being worked on in dev? git pull and drush cim would override everything you are working on in dev. I know there is drush cim --partial, but from what I understand this is not t ...

Score: 0
stckvrw avatar
Can't set custom document title in theme-settings.php
gb flag

I'm a newbie with Drupal, so I'm not sure I do everything correctly. I need to set custom document title (i.e. between <title> and </title>), not in a module, but in another PHP file for example theme-settings.php or even root index.php. I'm trying the following code:

function mythemename_preprocess_page_title(&$variables) {
    $variables['title'] = 'New title';
}

But the new title  ...

Score: 0
gMaximus avatar
How can I use $argument, in default value PHP, for a contextual filter?
sa flag

I'm using a entity reference field on some content types. The field references taxonomy terms. Then I'm using a view to filter the available options. I'm passing the content type to that view using this token - [node:content-type:machine-name].

Essentially the field is used on different content types but the value is the same on each content type.

So the field is called product type. Content type ...

Score: 0
Is the content of YAML files stored in the database somewhere?
mx flag

I just updated from Drupal 8.9.16 to Drupal 9.2.0. It worked fine in my test environment, but when I try on the production environment, I get the following error.

requires the 'core' key not be set in core/profiles/testing_install_profile_dependencies_bc/testing_install_profile_dependencies_bc.info.yml

I have looked in the core directory and do not have this path, so I am not sure why it is complaining ...

The Stunning Power of Questions

Much of an executive’s workday is spent asking others for information—requesting status updates from a team leader, for example, or questioning a counterpart in a tense negotiation. Yet unlike professionals such as litigators, journalists, and doctors, who are taught how to ask questions as an essential part of their training, few executives think of questioning as a skill that can be honed—or consider how their own answers to questions could make conversations more productive.

That’s a missed opportunity. Questioning is a uniquely powerful tool for unlocking value in organizations: It spurs learning and the exchange of ideas, it fuels innovation and performance improvement, it builds rapport and trust among team members. And it can mitigate business risk by uncovering unforeseen pitfalls and hazards.

For some people, questioning comes easily. Their natural inquisitiveness, emotional intelligence, and ability to read people put the ideal question on the tip of their tongue. But most of us don’t ask enough questions, nor do we pose our inquiries in an optimal way.

The good news is that by asking questions, we naturally improve our emotional intelligence, which in turn makes us better questioners—a virtuous cycle. In this article, we draw on insights from behavioral science research to explore how the way we frame questions and choose to answer our counterparts can influence the outcome of conversations. We offer guidance for choosing the best type, tone, sequence, and framing of questions and for deciding what and how much information to share to reap the most benefit from our interactions, not just for ourselves but for our organizations.