Latest Drupal related questions

Score: 1
Francesco Marchetti-Stasi avatar
How do I alias jQuery to $ before loading a remote library?
iq flag

I am trying to use Bootstrap autocomplete in my module. I added this to my .libraries.yml.

bootstrap-autocomplete:
  remote: https://bootstrap-autocomplete.readthedocs.io/en/latest/
  version: 2.3.7
  license:
    name: MIT
    url: https://getbootstrap.com/docs/4.0/about/license/
    gpl-compatible: true
  dependencies:
    - core/jquery
  js:
    https://cdn.jsdelivr.net/gh/xcash/bootstrap-autocom ...
Score: 0
Patoshi パトシ avatar
Displaying all pages in a BOOK teaser block within a block
kr flag

I'm trying to display all the BOOKS in my site as a teaser block with the pages below it.

Like this:

Title: This is the book of my Cat
Page: 1 2 3 4 5 6 7 8 

Title: This is the book of my Dog
Page: 1 2 3 4 5 6 7 8 

Title: This is the book of my Bird
Page: 1 2 3 4 5 6 7 8 

I have the following View setup to display the teaser of the books on the site filtered by the value of having children or not.

 ...
Score: 0
Glenn avatar
How do I conditionally restrict an attribute
ph flag

I'm using Drupal Commerce 8.x-2.x on Drupal 9.5.x. I need to restrict a particular product attribute to certain regions (regions selected via an attribute). My thinking is that the region is selected via an attribute; I can't see another way to do it for my means.

In my use case, regions are not location based geographical regions; they are locally defined regions, so I can't see a way other than ...

Score: 0
LBRTYCAT avatar
Attaching a library to only one custom module
us flag

I wrote a sample custom module (juniper) and created the corresponding juniper.libraries.yml file to link the CSS and JS. I am trying to load this library only on this module pages (/juniper). However, I have issues:

  1. I tried to add the library via juniper.info.yml:
libraries:
  - juniper/june

but this doesn't work for some reason

  1. I added the juniper_page_attachments hook to the juniper.module
Score: 0
River Liver avatar
Can't get Plupload Integration test module to work
je flag

I've installed Plupload integration on my Drupal 9 local Docksal site but can't get the example module to work. The library is properly installed according to Status Report. I enabled "Plupload test" went to the test page, tried to upload a zip file and the file won't upload. In the console I see an error at /plupload-handle-uploads?token=XJtEGstKW7...

{"jsonrpc":"2.0","error":{"code":105,"message":"I ...
Score: 0
Patoshi パトシ avatar
Display the last page in a BOOK content type as a link?
kr flag

I'm currently using the core BOOK content type as a form of discussions. I created a views page with all the books and titles exposed. But I also want to append the last page of the book in the Views page. Setting the Depth = 1 I get the first page of the book and title, which is correct. But how do I set it to show the last Depth of the book so it can create a link to the last page?

enter image description here

Score: 0
quantumized avatar
How to add condition via views_query_alter() to filter a multi-value select field that does not contain a value?
ng flag

I have _views_query_alter() hook that I need to filter out nodes whose multi-value select does not contain a value ("National"). The code below works to show the nodes that do contain "National" but I need to do the opposite and cannot get it to work due the field being a multi-value field.

function HOOK_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {

  if ($view->id() == 'state_lan ...
Score: 0
Brian Gradin avatar
Is it possible to recreate cache tables from a more fixed source?
th flag

I am working with a dockerized Drupal environment in which we want to track content alongside our theme, modules, etc in source control. We achieve content tracking by using mysqldump to dump the database to disk, with one table per file. Then when the environment is created using Docker Compose, the SQL files on disk recreate the database state. We also track certain files from sites/default/files

Score: 0
Switching from table to graph give wrong data
kn flag

I'm using the Drupal Commerce Report module as a base for my stats. I have a table which give me data about my sales per month.

enter image description here

I'd like to use graph instead of table, to make it easier to compare. For some reason, the coma is gone, so all my sales reports are wrong

enter image description here

I tried to alter data in a pre_render, in a preprocess (by checking the format, test with a dot instead of a coma) but still having ...

Score: 0
timmyblaze avatar
Field values in node HTML body
do flag

I am using Drupal 10 and trying to edit the body of a node. I want to use the node field values in the HTML body, for example [field_name], but this does not appear to work as it only shows that specific text and not the actual value of the node. I also have tried [field:field_name] with no such luck. Is there any way to do this without having to edit any template file? I have the text format set to 'Full ...

Score: 0
Attach a webform to a content type such that you fill out the webform when editing the content
cn flag

Adding an entity reference of type Webform makes it so when creating the content, the specific webform can be selected and it can be set to open or closed, but the webform is filled out by people viewing the content, rather than by content creators when editing the content.

Another sort of entity reference could theoretically make it so the webform is shown when creating/editing the node or other c ...

Score: 1
Tomáš Bažant avatar
Display only search box with live search and no content with results
de flag

I have configured search API with autocomplete, the search box is exposed in a views block. But the block displays the default 5 results below the search box even if the box is not used yet. I want the search box only to be visible, not the content of the block. But i cant seem to set the number of displayed result to 0. Any idea?

search api live box

Score: 0
user3108268 avatar
How to upload .webp to Image field?
us flag

https://www.drupal.org/project/imagewebp lets you upload a regular jpg/png which converts it into webp, but how to upload already a file that is in webp?

Adding it as one of allowed extensions in the field setting does not work.

update As an alternative this can be solved with https://www.drupal.org/project/file_entity, but this is for the file field and not image field.

The question is about image  ...

Score: 0
Drupal Learner avatar
Use AJAX On Node Add Form To Change Field Required Status
gf flag

On a node/add form I have a pair of fields that need to be able to control one another. The first field allows a user to enter a birthdate, the second field allows the user to say the birthdate is unknown.

I have attempted to work with Conditional Fields to make this work but I think for my case AJAX would be better.

If the birthdate_unkown field is not checked then the birthdate field should be requi ...

Score: 0
How to find bad tokens stored in config automatically?
cn flag

I recently deleted some fields (media_term_fruits) and created new fields (media_fruits) on a local dev site. I then exported the config and pushed it to my dev server.

My dev server uses Github Actions to import config and everything imported with no errors.

However, for my media image fields, I set the image path using a token via the Filefield Paths module. This token referenced a deleted field (

Score: 0
Html5 tags and javascript stripped out form radio labels
it flag
MMT

On D7, I have the following simplified code

    function mymodule_multistep_form($form, &$form_state, $vars) {

    $mystatictext = get_my_static_text($vars);  
    $options ='<div class="player"><audio><source src="castel.mp3" type="audio/mpeg"></audio><a style="cursor:pointer;" onclick="toggleAudio(this.previousElementSibling)">' . $mystatictext .'</a>
     ...
Score: 0
Hassan Alsheikh avatar
Case-insensitive ignoreCase - text field
sa flag

i am trying to create a text field that accepts case-insensitive text but be unique.

Hassan is hAssan is haSsan...etc

i have tried a different combinations of regex with no success. i would be thankful if someone could help out with this.

where can i suggest if J could add a toggle switch (ignoreCase on/off)?

enter image description here

enter image description here

enter image description here

Score: 0
Patrick Man avatar
On android, keyboard comes up momentarily and then disappears when a user clicks the search field (likely due to triggering a js resize event)
cn flag

Related to this: https://stackoverflow.com/questions/51493956/android-keyboard-appears-and-disappears-when-clicking-search-input

We have some javascript that rearranges a couple elements in the page pretty dramatically depending on if we are on mobile or not (beyond what flex css could handle).

Unfortunately, on android (but not iphone), when our users click on the search field and the mobile keyb ...

Score: 0
bricknewer avatar
Why might a panel pane print a block as class="panel-pane pane-block..." vs class="block block--views..."?
tw flag

I apologize if the wording for this question title does little to explain my problem. I'm so deep into not understanding an issue I'm having trouble describing it.

To preface, I'm quite a noob with drupal 7, I really know just enough to be dangerous. I may use a wrong word to describe something, so sorry about that.

I'm having [multiple] issues while attempting to clone a previous project on my webs ...

Score: 0
Kathryn Carruthers avatar
With English, French and Spanish enabled. Recently our Comms folks can't add translations
id flag

We're using Drupal 9.4.10 - turned on content translation for the Comms role for all content types, URLs, etc. but that role cannot create translations for any content type. They can edit the translations after they're created by an Administrator. Other than giving them Admin permissions does anyone have any ideas about how this could be?

They can actually click on Add translation then fill in th ...

Score: 0
Ivan Ginovski avatar
Paragraphs field preprocess hook not called
jp flag

To simplify this issue, I just have 2 hooks:

1. customtheme_preprocess_paragraph__registration_button()
2. customtheme_preprocess_paragraph__registration_button__default()

When I access a node with a registration button with a default view mode, only the first hook is called. Also, when I access the $variables['view_mode'] in that hook, it gives the value 'default'.

Furthermore, it only takes the para ...

Score: 0
Sudha avatar
How to alter pagination url of embedded view programmatically?
sj flag

I m trying to send mail which contain some data along with embedded view result programmatically. This mail is trigger on submit of webform. Webform ajax property is enable. Due to which it send incorrect url.

Used below code

$view = Views::getView($viewID);
$view->initDisplay();
.....
$vars['result_table'] = $view->buildRenderable('email', $contetxtualFilter);

In twig file

{{ result_table }}
 ...
Score: 3
Tracy avatar
Aegir for Drupal 10
sz flag

With Aegir being developed in Drupal 7 and the end of life looming for this November are there plans to migrate Aegir from Drupal 7 to 10? Or can anyone direct me to where I can find the migrated version.

Score: 0
Rubix05 avatar
How to set media field mappings to autofill the target fields when uploading the file instead of saving to those files when saving the media entity
cn flag

I am using the document media type for pdfs. I am also utilizing the field mappings for:

  • Name
  • MIME Type
  • File size
  • and I will be adding a field mapping for the pdfs subject as well using a Media source plugin.

These are working as expected when I save the media entity; however, I have the additional requirement that the Name and Subject fields will be auto-populated when a file is initially selected. ...

Score: 0
bigmike7801 avatar
Can I change the autocomplete to a dropdown for the entity_browser module?
nz flag

I'd like to be able to change the autocomplete for the Site Sections portion of the entity_browser module.

I'm not seeing any way to modify this within the admin. Am I missing something? Can I do this in config? Do I need to create a custom patch?

enter image description here

Score: 0
Sarah C avatar
How to show layout's label or description in a custom Layout Builder settings form
za flag

I have successfully made custom layouts and a custom settings form, something like this: https://www.codimth.com/blog/web/drupal/how-add-custom-settings-layouts-drupal-8-9

I want the custom settings form to include the layout's label and description as I have defined them in the layouts.yml file.

Like, at the top of the form before my settings, the name of the layout and then the description. I don't ...

Score: 0
droopal avatar
How to add variations of a product to the cart if only the first variation have all attr values
hk flag

Consider a product. For example it has 5 different colors that is 5 product variations. But all other values of the product's attributes (size, weight etc.) are the same for all the variations of the product regardless of the color. That is all 5 variations of the same product have the same weight e.g. 2 kg.

Unfortunately, the module Drupal Commerce allows a buyer in the front-end to select by cl ...

Score: 2
How to remove a css file from an already-overridden definition?
US flag

I want to create a custom theme and remove a css file from diretory themes/stable/css/filter.caption.css from Stable theme. I found this file in stable.info.yml

libraries-override:
  filter/caption:
    css:
      component:
          css/filter.caption.css: css/filter/filter.caption.css

From my_custom.info.yml

libraries-override:
  filter/caption:
    css:
      component:
        css/filter.ca ...
Score: 0
Baud avatar
Sub request doesn't take care of the language
sa flag

I have defined a route as follow:

mymodule.node_summary:
  path: '/node/{node}/summary'
  options:
    parameters:
      node:
        type: 'entity:node'
  defaults:
    _controller: '\Drupal\mymodule\Controller\NodeSummaryController::content'
    _title: 'Summary'
  requirements:
    node: \d+
    _entity_access: 'node.view'

Then I have created the following controller:

class NodeSummaryControl ...
Score: 1
inertiahz avatar
Module template for a comment field is not triggering comment_preprocess_field
ng flag

I have a custom module in which I am trying to override a comment field's template in Drupal 9.3.

In my module file I have defined the hook_theme to override the core template in use. (comment.html.twig), which works, but it is not triggering the comment_preprocess_field hook in comment.module which then assigns the comment variables to the template.

My module file hook_theme is:

function MODULE_t ...

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.