Latest Drupal related questions

Score: 0
"Language missing or invalid"
eg flag

I am using Drupal Version 9.5.5 and Forum core module. After enabling the module and creating a forum container, forum, and topics, the module creates a page at /forum/ with a table list of the forums.

Chrome Wave shows an error in the Last post column: Language missing or invalid. It is coming from the variable {{ forum.last_reply }}

This is an example of the HTML markup.

<a title="View user p ...
Score: 0
Chris avatar
Show Siblings via Views and taxonomy term in a block (again)
ec flag

I've got a

  • D9 site
  • with an Event content type and a reference to the
  • place taxonomy term

In the taxonomy term, there is a field zip_code. The taxonomy terms are setup in a hierachy:

  • State 1
    • County 1
    • County 2
      • Town 1
      • Town 2
      • Town 3
  • State 2
    • ...

Now, someone would search for the zip code and find e. g. Town 1. I've got one page which will show the referenced events within town 1 - no problem at al ...

Score: 0
Francesco avatar
Leaflet custom marker doesn't work on multiple points
ht flag

I am using Geofield field with Leaflet module. I need to customize the marker and I'm having a problem with content types that have more than one point on the map.

While for ctypes that have only one dot the marker is replaced correctly, for cypes that have multiple dots or a dot and a dash the marker always returns to the default one.

Has anyone had a similar problem and know how to fix it?

Score: 0
Christoforos avatar
Override the results of Search API pages module
lc flag

I have disabled the default search and enable module 'Search API' and Search API SOLR(used for Backend) to perform search in Drupal 9. I have also enabled Search API pages module and created a search page through this module.

Search API pages module has 2 twigs in folder templates. I have overridden both and when I make a change in search-api-page.html.twig I see difference in the search page but ...

Score: 1
How can I render comment pager on the top and the bottom of the comments portion of the page
pe flag

When comments are numerous on a node and you have a high comments per page setting, you have to scroll a lot to get to the pager. My users have requested pager at top as well as bottom of the comments list (not the top of the page) on a default node page.

To clarify

Current page layout

  • Title
  • Content
  • Comments
  • Pager
  • New comment form

The desired result is

  • Title

  • Content

  • Pager

  • Comments

  • Pager

  • New com ...

Score: 0
How to enforce a specific aspect ratio for all Media images?
cn flag

With the core media Image type, I want to restrict uploaded images by aspect ratio.

I want to block images that have the wrong aspect ratio from being uploaded. My question is the same as this Drupal 7 question, but for Drupal 8+.

Score: 0
NunesRodz avatar
Custom field Widget multiple values as a Table
gs flag

Hello I created a custom field type and field widget with multiple values, one entity reference and two checkboxes.

Everything's was working well, but to improve the usability of the fields, I would like to display the fields as a table, and that is when my problem begins.

I tried changing the field widget to be like a table, that visually worked to me, but now I will have problem because the keys o ...

Score: 0
Todd avatar
Displaying an entity pager in an article if that article is included in an entityqueue
mv flag

I want to have a pager at the bottom of articles that a user can cycle through, that consists of other articles that are in the same entity queue list that the current article is also inside of.

I'm using Entityqueues to create arbitrary lists of articles and I'm using Entity Pager in a view to display that list of entity queue items a set of previous/next navigation links.

Within the entity pager v ...

Score: 0
abe-cedarian avatar
When iterating over multi-value fields is it considered best practice to override the field template vs loop over the var in node or block template?
kr flag

I have a link field that allows multiple (3 max) values on a custom block for which I'm using a twig template.

I want to iterate over the values using a for loop.

I got this to work the way I wanted in my block twig like so:

{% for key in content.field_footer_cta_buttons|keys %}          
  {% if key matches '/^\\d+$/' %}
    <a href='{{content.field_footer_cta_buttons[key]['#url']}}'>{{ content.f ...
Score: -3
beltazzar avatar
Does Drupal core include any comment spam prevention mechanism?
do flag

I have a Drupal 9 core website and I have allowed comments in it (approval needed).

The problem is that my website is flooded with spam boots posting links in pre-approved comments. This causes burden of filtering human-legitimate comments. I also desire not to install any modules and work only from the core.

Does Drupal core include any comment spam prevention mechanism?

I don't recall ever finding a  ...

Score: 1
Tobias Krause avatar
Custom views filter plugin: filter over two fields of a custom entity where one of the fields is a multi value field in a seperate table
cn flag

I have a custom entity with two basefields of type "list_string": "role" and "additional_role". I need this as "role" is used for sorting the entities by a very specific logical order (like the "boss" comes first and the "team lead" after the "boss"). The "role" basefield is a simple one-value field which is stored in the entity table in one column but the "additional_roles" is a multi value field which ...

Score: 0
user5274714 avatar
How can I fire a Google analytics tag event on every form post?
bi flag

I want to see statistics for forms submissions, grouped by type of forms. I am using Google Analytics 4 (https://www.drupal.org/docs/contributed-modules/google-analytics/using-google-analytics-4x). I tried adding a GA event on form submit like this:

 /**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  // Add the tracking functionality to th ...
Score: -2
MrUpsidown avatar
Issues updating from 9.4.3 with composer
eg flag

I have a project that wasn't updated since a few months and I am stuck on 9.4.3 with composer refusing to update.

Here is my composer.json

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 9 projects with Composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
 ...
Score: 0
user110123 avatar
How would I access the pdf generated by Webform's Attachment PDF in a custom Webform Handler?
ge flag

I have created a custom Webform Handler that takes the files uploaded by the user on a Webform and uploads them to the third-party file management system Box via Box's API. I want to also upload the Attachment PDF that is generated but I don't know how to get the file programmatically. I can click on the pdf links generated and they successfully download as expected. However, if I try to load that fi ...

Score: 0
Iulian Boiculese avatar
How to display the output of the View as json in the list of articles which use paragraphs?
sk flag

I have a content type Article which has a field_paragraph field.

Also I created a Paragraph type: View Paragraph which has a View reference field

When I create an article, in the field_paragraph field I added a reference to a view in order to get the list of titles from another content type: Basic Page.

I'm using JSON API module in order to get the list of articles in json format for a front-end app ...

Score: 0
Using the off-canvas dialog, how can I submit and close it, without redirect?
cn flag

I use this as link:

<a
  class="use-ajax"           
  data-dialog-options="{&quot;width&quot;:800}" 
  data-dialog-renderer="off_canvas" 
  data-dialog-type="dialog" 
  href="/group/1/content/create/group_node%3Apage"
>
  Create page
</a>

When submitting the page, I like the dialog to close without redirecting the new page created.

How can this be accomplished? If I add ?destination= ...

Score: 2
Tomáš Bažant avatar
How to group taxonomy terms by depth in views?
de flag

my example taxonomy looks like this:

- fruit
 -- apple
 -- orange
 -- banana
- vegetable
 -- carrot
 -- cabbage

i want to render a page in views that groups level 1 terms by their parent term, The page should look like:

Friut
apple | orange | banana

Vegetable
carrot | cabbage

How can i do such grouping? Thanks!

Score: 1
Adamssef avatar
Replace MessageTemplate with token value and send the message
in flag

I'm having some trouble getting the tokens in my Drupal 9 message template to work properly. I have created and saved a message in my UI using the structure->message templates section, with a WYSIWYG text format field that contains the following:

User [user:account-name] changed details. https://mysitename.com/user/[user:uid]

I'm concerned about the code snippet I've been using to send this message,  ...

Score: 1
liquidcms avatar
How do I make a subgroup of custom tokens under the Nodes top level token group?
us flag

I have a few custom tokens to create which are based off of node context. At first I thought I could have them as their own top level group with code like this:

  $info['types']['mpep_policy'] = [
    'name' =>  t('MPEP Policy'),
    'description' => t('mpep policy tokens'),
    'needs-data' => 'node',
  ];
  $mpep_customs = ['Liability:Each Occurence', 'Liability:General Aggregate', 'Busi ...
Score: 1
awm avatar
How is a ckeditor plugin form is discovered and loaded for the plugin?
mx flag
awm

I am trying to understand how Text filters settings form are used. For example, if you look at the url_embed module it has:

src/Form/UrlEmbedDialog.php
src/plugin/Filter/UrlEmbedFilter

How does the filter plugin connect to the form? I.e. when you click on a plugin button in the text field (body field of a node) it shows the form with a URL text field to embed. This form is defined independently in

Score: 0
Sarah C avatar
Get link to content in entity reference field template
za flag

I have an entity reference field set in Manage Display to 'Rendered Entity' and am working with the field's template to conditionally show the link based on the referenced node's published status. I'm using 'Rendered Entity' so I have access to isPublished().

How can I get just the path of the referenced node in the field's template?

Within {% for item in items %}, this works great to get the referenced ...

Score: 0
Ramalingam Perumal avatar
How to get value from object in twig template file?
mx flag

I can print the result object by {{ dump(item.value['#result']) }} in theme item-list--search-results.html.twig template file.

enter image description here

I want to print the body field value("body"=>"value") from the object.

How I will do ? I have tried some other ways which I know

  • {{ dump(item.value['#result']['node'].#values['body'][0]['value']) }}
  • {{ dump(item.value['#result']['node']['#values']['body'][0]['value']) }} ...
Score: 1
Crystal avatar
Barrio Theme 5.5.10 Main Menu submenu does not output list items
tf flag

I need help with the Barrio Theme submenus. I upgraded our site to 5.5.10 to discover the menu has stopped working. In my attempt to figure this out, I recreated a test site locally and installed a Drupal 9.5.5 legacy-project and barrio 5.5.10.

The submenu is not outputting the listing of the submenu. The documentation says all parents must be expandable and they are. I dont know the system is ig ...

Score: 0
miststudent2011 avatar
how to alter entity reference field (taxonomies) field options in hook form alter
fr flag

Can anyone please let me how to alter entity reference field (taxonomies) field options in hook form alter,

Seems the below code doesn't work.

/**
 * Implements hook_form_alter().
 */
function MY_MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'node_article_edit_form' || $form_id == 'node_article_add_form') {
    $channel_options = [
      '1' => 'Term1', ...
Score: 0
shibasaki_stack avatar
Unable to update node entity fields using custom form
zm flag

There is a certain content type, in which there is a field to enter a node or taxonomy. I want to create a new node for that content type using a custom form and register the node or taxonomy in the entity field.

$form['client_company'] = [
  '#type' => 'entity_autocomplete',
  '#target_type' => 'taxonomy_term',
  '#tags' => TRUE,
  '#selection_settings' => array(
    'target_bundles' = ...
Score: 1
States on input type button broken since core update
kn flag

I've updated my Drupal project from 9.5.3 to 9.5.7, but the submission button's #states property stopped working.

$form['actions']['submit'] = [
  '#type' => 'submit',
  '#value' => 'Accéder au paiement',
  '#enabled' => FALSE,
];

$form['actions']['submit']['#states'] = [
  'enabled' => [
    [
      ':input[name="name_1"]' => ['empty' => FALSE],
      ':input[name="name_2"]' = ...
Score: 1
Jordi Bustos avatar
Why does the error 'You have requested a non-existent parameter "site.path"' occur on module configure buttons?
mr flag

When I click some configuration buttons for example in layout builder UI or the following buttons. enter image description here I get the following error in admin/reports/dblog

Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException:
You have requested a non-existent parameter "site.path". en Drupal\Component\DependencyInjection\Container->getParameter() 
(linea 328 de /var/www/html/core/lib/Drupal/Component/D ...
Score: 0
Sudha avatar
can't get multistep ajax webform work with computed field
sj flag

When ever I use multistep webform with computed field and try to enter data in second page, webform redirect me to first page with validation error. Source code of my webform,

    page_1:
      '#type': wizard_page
      '#title': 'Page 1'
      name:
        '#type': textfield
        '#title': Name
        '#required': true
    page_2:
      '#type': wizard_page
      '#title': 'Test Page'
       ...
Score: 1
arirams avatar
Content moderation and changing node state on default or latest revision
gh flag

I am using content moderation and sometimes I update the moderation state of my entity programmatically in a hook node presave for example. I usually have the entity and I can do $node->set('moderation_state', "needs review"); , however my question is, if for some reason in a controller, I want to do the same thing in a function that doesn't have the node entity as parameter, I wanna load the nod ...

Score: 0
Adding cache tags to custom block
kn flag

I have a custom block which load some taxonomy terms.

When I made changes to my taxonomies, the block isn't loading the new data (due to the cache). I'm passing all my taxonomy tags to my #cache return, but nothing append when I reload my page. I still have to drush cr to see the changes (even tried with taxonomy_term_list, but didn't work either)

Here's a simplified version of my block :

<?php
 ...

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.