Latest Drupal related questions

Score: 0
FonkyJu avatar
Help for center Geolocation Polygon Map with Leaflet?
cn flag

Is somebody knows how to center a leaflet map with a geolocation polygon field? I want to center the drawing of polygon like below but there is just few options which don't help me.

enter image description here

To reproduce :

  1. Install Geolocation Project and All Demo
  2. In admin/structure/types/manage/geolocation_geometry_demo/display , change the format of Geolocation Geometry Polygon in "Geolocation Geometry Formatter - Map" and Sav ...
Score: 0
john Smith avatar
CKEditor5 Medialibrary insert add custom classes
gr flag

For my text-format i have "drupal media insert" in my toolbar, when choosing an image to insert there are options to align the image, i.e "align left break text" it will add a data-align attribute and in the frontend add a class ".align-left"

Is there a way to add further classes to the figure element without patching the core files?

Right now I am using a behaviour for that, but that feels like a w ...

Score: 0
acey avatar
Composer cannot install Feeds Extensible Parsers?
mu flag

I'm trying to install the feeds extensible parser module using Composer but the following error keeps showing up. Problem 1

- Root composer.json requires drupal/feeds_ex, it could not be found in any version, there may be a typo in the package name.

Potential causes:

  • A typo in the package name

  • The package is not available in a stable-enough version according to your minimum-stability setting

    see

Score: -3
Peladon avatar
Is the libmysqlclient version core requirement actually required?
sm flag

So it's been a while since I was doing things with Drupal. For a number of reasons, I decided to put my toe back in the water and install Drupal 10 on my hosting service. All went well, or I thought it did. The status report post-install showed this.

10.5.20-MariaDB-cll-lve-log
The libmysqlclient driver version 3.1.21 is less than the minimum required version. Upgrade to libmysqlclient version 5.5.3 ...

Score: 2
sonfd avatar
How to access validated values after AJAX callback when fields are nested in a container?
in flag

I have a custom form where I have a search field and button. After the users clicks the button, I load some items based on what they've entered into the search field.

The problem that I'm having is that when my form is being rebuilt after the AJAX callback is fired, there are no values in $form_state->values so I can't access them with $form_state->getValue(). However, I do see the input in

Score: 0
Giuseppe avatar
How can I make route optional parameter "dynamic"?
br flag

I have a route which need to have the language code as optional parameter:

my_module.my_route:
  path: '/custom-link/{langcode}'
 defaults: 
    _controller: '\Drupal\my_module\Controller\MyController:render'

I know from Optional parameters how to make a static optional parameter.

However, I need to determine the parameter dynamically: if it is not provided in the url, it should be the site's defa ...

Score: 2
alex avatar
Unable to upgrade from Drupal 9.5.10 to 10.1.1
io flag

I'm stuck on my efforts to upgrade my sites (I have 5 in total that I manage) from Drupal 9.5.10 to 10.1.1. I'm using PHP 8.1.8.

I'm following the instruction from https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-site.

Upgrade Status gives me two problems:

  • Dynamic Entity Reference: there is no version compatible with both 9.5.10 and 10 so I've f ...

Score: 0
fallenturtle avatar
How can I confirm a path is internal?
au flag

In my theme's theme file I'm using preprocess_node to create variables for a node based on the section of my site its in, and that's figured out by checking the path's alias.

So for example a path like: /events/this_is_my_node

It'll see that this node is in the events section of the site and the variables provided to the twig template facilitate theming the node page based on the section it's in.

Score: 0
Monki avatar
Menu links to media library items
tj flag

Is it possible to link to media library items such as documents and images rather than be restricted to content nodes?

Fairly new to Drupal development and thought this would be fairly standard but struggling to find a clear direction. Looking to generate links to certain documents within a mixed menu but the option is not found when searching, only generated content pages are returned as matches ...

Score: 0
Extract image meta data and set field values on Media upload
ec flag
Tim

I'm extracting IPTC and EXIF data when the user uploads an image using the Media Library UI.

Using hook_form_alter I can get the URI of the uploaded file in the media_library_add_form_upload form, and extract the data from it. So far, so good.

However, the form does not (yet?) contain the other fields attached to the media type (e.g. title, description, copyright) so I can't set the values.

How c ...

Score: -1
Content type with 3 paragraphs fields: How can I output to different parts of page.html.twig?
US flag

I have a content type called (My Page) with 3 paragraph types, for a slider to display images, for text to display text, and for sidebar content. (The sidebar is a <div>, not a Drupal region/block).

Using the page.html.twig template, I am able to output the content to {{ page.content }}. However, it dumps all the content of all 3 paragraph types in one place.
I'd like to be able to separate t ...

Score: 0
Loubna avatar
How can I change the place of the js and css files generated by advagg to another place
mv flag

How can I change the place of the js and css files generated by advagg to another place, for example in a folder at the root of the site.

Thanks for your help

Score: 0
Jake13 avatar
How do I display only the "View" tab for a specific webform and role?
us flag

I have multiple webforms, In each of these webform submission results page I require only view page, when a non admin user uses the site to see the results, they should only see the view tab and the table, how do I unset the "Edit" tab in primary local task/tab for a specific user role and specific form and only display view tab in primary task and table in secondary local task. I did try with Tabtamer  ...

Score: 0
Ashok Negi avatar
Inline Entity Form - is it possible to add field from child entity's taxonomy reference field
in flag

I have the below structure on my Drupal 9 site:

Product content type
  -- field_product_integration (references contents of type Integration)
Integration content type
  -- field_product_feature (references terms from Features Taxonomy)
Features Taxonomy
  -- field_feature_category (Dropdown with three possible options)

On Manage Form for field_product_integration I have selected Inline Entity From Comp ...

Score: -3
themer avatar
External CSS file isn't loaded
dz flag

I am trying to load an external CSS file to globally effect my website.

I have tried the following in /core/themes/olivero/olivero.libraries.yml but no change occured after cache rebuild.

global-styling:
  version: VERSION
  css:
    base:
      css/base/fonts.css: {}
      css/base/base.css: {}
      css/base/utility.css: {}
      css/base/https://raw.githubusercontent.com/USER/REPOSITORY/main/web ...
Score: 0
relmayer avatar
Automation of publishing using Rules and Workflow
bt flag

I am currently working on automating status changes in Drupal, my task is to use the Rules and Workflow modules to configure status changes after a certain period.

For better understanding, I'll give you an example: I need an Article to automatically switch from the Draft status to the Reviewed status after a certain period of time after the Article is created (for example, 24 hours).

The problem is ...

Score: 0
themer avatar
How to load a CSS file from a URL?
dz flag

I have a raw github page with CSS:

https://raw.githubusercontent.com/USER/REPOSITORY/main/website/style.css

How to load it in my website to effect the website globally?

I tried this in /core/themes/olivero/olivero.libraries.yml but no change occured after cache rebuild.

global-styling:
  version: VERSION
  css:
    base:
      css/base/fonts.css: {}
      css/base/base.css: {}
      css/base/util ...
Score: 0
amos_a avatar
Why is the cURL extension needed?
py flag

PHP requirements contains the following text.

The PHP cURL extension is required for automated testing in Drupal 9 and higher, as well as Aggregator and some contributed modules.
Many Linux distributions and development stacks will have it enabled by default, but if your system doesn't either enable it in php.ini (typically on Windows) or install it using your package manager (typically on Linux).

 ...
Score: 0
NicklasF avatar
Set form values based on ajax callback
us flag

I am creating a complexed multistep form based on data from an Excel document. The user can save parts of the form using AJAX save buttons and updated data from the Excel document are displayed in the form. I am fetching a lot of data from Excel - some are for inputs and some are read-only which are not put into FormState.

The issue is that I need to populate the form with data based on the API c ...

Score: 0
af_elkb avatar
The tab "Latest Version" does not appear and neither is the path /latest working (Drupal 9.5.8)
in flag

I have the modules Workflows and Group content moderation installed. I also configured a workflow for a particular content type. My problem is that although I can change the moderation state in the "edit" mode of the node I don't see the tab "Latest version" on the node's page. I tried the path www.my-domain.com/node/123/latest, but all I receive is the "page not found" message. I am logged in as Admin an ...

Score: 0
developer avatar
How can I get the href value from a link?
ua flag

I have a link I render in a template file with the following markup.

{{ item.caption.link }}

I want to show only the href value. None of the following worked for me.

{{ item.caption.link[0]['#url'] }}
{{ item.caption.link.0.url }}
{{ item.caption.link[0]['#url']|render }}
Score: 1
John Doe avatar
Set error message only on errornous field(s) when validating multiple instances of the same field
ne flag
  • I have a form where the users can add one or more "units".
  • I want to validate and return an error message on the problematic field when the unit does not have a value "leader"
  • With the below code, an error message appears under all unit fields even if some inputs do not have error.

How can I add the error message only to the problematic field? Here's my attempt so far.


    // Foreach $values['unit'], c ...
Score: 0
leeksoup avatar
webform contact form gives access denied for anonymous users
gw flag

I have a few webforms on my D9 site. They all work for anonymous site visitors except for the contact form, which gives an "access denied" error.

The permissions under the form's Settings->Access tab are the same as for other forms that do work.

The form's access permissions are set to allow anonymous / authenticated / admin users to create and view/ update own submissions: Create submissions: Roles: anonymous user, authenticated user, administrator

View/ Update Own Submissions: anonymous, authenticated, administrator

I did search for the s ...

Score: 1
How can I get the user UUID using the JSON API?
cn flag
blu

I tried the following JSON API query strings to get the UUID, but I keep getting a 404 error.

  • {url}/jsonapi/user/user?filter[uid][value]={uid}
  • {url}/jsonapi/user/user/{uid}
  • {url}/jsonapi/user/user?filter%5Banon%5D%5Bcondition%5D%5Bpath%5D=uid&filter%5Banon%5D%5Bcondition%5D%5Bvalue%5D=0&filter%5Banon%5D%5Bcondition%5D%5Boperator%5D=%3C%3E

EDIT:

Forgot to include this route: {url}/user/{ui ...

Score: -1
Matoeil avatar
jQuery selector does not find the view content after document.ready event
za flag

I am applying some jQuery to make a slick carousel from a Drupal view.
The carrousel does not work erratically on page load; sometimes, it does, sometime it doesn't.

jQuery(($) => {
  $(document).ready(() => {
    console.log('ready');
    if ($('.view-carrousel .view-content').length) {
      console.log('content?'); //enters here erratically
    }
  }
}

Do you have any explanation?

Is it cache b ...

Score: 0
user871967 avatar
How can I extend the maximum number of items in a menu?
aw flag

I maintain a website where a particular content type is always displayed with a left-hand navigation menu present. As part of the process for adding new content of this, the site editors add a link to to the content to the left-hand menu. However, they do not enable this link, although the relevant parent item is enabled. Thus when users visit the content page, the left-hand navigation menu displays jus ...

Score: 0
ewik avatar
How to render the image or several images in the table render element?
fi flag

I have a form. In the last step of the form, I display in the table what was saved in the fields in the previous steps.

Where there is a comment in the code, I need to render the all images from the $taxonomy_pms_color that was saved in the previous steps.

$quote_printing_pms_colors = $quote_print_location->get('field_pms_colors')->getValue();
$pms_colors = '';

foreach ($quote_printing_pms_c ...
Score: 0
user1414202 avatar
How can I get conditional logic working when embedding a webform?
ve flag

When embedding a multi-page webform within a render array using #type => 'webform', it seems like there's a bug where the conditional logic of webform elements does not work.

Note: The webform's conditional logic does work when I view the webform in webform's actual "View" and "Test" pages.

Furthermore, when embedding a webform on a page using a block, the conditional logic also works (but the pa ...

Score: -1
Alex Malik avatar
disable the registration form
az flag

How can I remove the Registration tab in Drupal 9?

screenshot

Previously, this was possible by changing the user settings.

Score: 0
Set cacheability on a custom route returning XML
in flag

I'm working on fixing a custom module that returns XML from a certain route. Essentially what is described in the answers of this question.

Currently this route isn't being cached. I've tried to switch to using CacheableResponse and setting cache tags but received the error "The controller result claims to be providing relevant cache metadata, but leaked metadata was detected"

At this point I feel a b ...

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.