Latest Drupal related questions

Score: 0
jared03e avatar
Aegir - Debian PGP key has expired
id flag

I am trying to Install aegir on Ubuntu 18.04 and 20.04 lts to manage drupal sites. Every time I try to update the server and install aegir it displays the following error
me@userpc:# apt-get update

Hit:1 http://et.archive.ubuntu.com/ubuntu bionic InRelease

Get:2 http://et.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]

Get:3 http://et.archive.ubuntu.com/ubuntu bionic-backports InRelease [ ...

Score: 0
levente.nas avatar
Is there a way to validate access & refresh tokens issued using the Simple OAuth module?
kw flag

I am using the OAuth2 authorization code grant with the Simple OAuth module. Everything is working, however I would like to be able to validate access and refresh tokens from my frontend NodeJS server. Is there an API endpoint to which I can send a token to, and in the response I get information about that token (aka token introspection)? For example, a response telling me the token is expired.

T ...

Score: 0
levente.nas avatar
How can I disable or handle session cookies in a decoupled setup?
kw flag

I'm a little confused about how one should handle Drupal session cookies in a decoupled setup. I have a frontend NodeJS server which communicates with the backend Drupal via REST APIs. For user login, I'm using the SimpleOAuth module with the authorization code grant. When the user presses login on the frontend. they're redirected to the Drupal authorization server where they login. Once they are logged ...

Score: 1
liquidcms avatar
Can I use Price Resolvers for dynamic product pricing?
us flag

All cart items are adding programmatically. I am trying to set a product cost based on various factors that change for each instance of an item added to the cart.

I discovered Price Resolvers and it seemed like it was working until I ended up adding 2 of the same "dynamically priced" items to my cart. Each was passed different prices and in my resolver I can see that the price is set correctly fo ...

Score: 0
Twig template for field component of specific form
ua flag
Sam

I'm using template hints to attempt to theme a specific part of a single form.

I have a custom template for a views block (block--views-exposed-filter-block--search-custom-page-1.html.twig), but is it possible to have a specific template for an element of that form, for example, the label?

For example, if the universal template file is:

templates/form/input.html.twig 

is

templates/form/block--views-exp ...
Score: 4
Scott avatar
How can I change allowed tags in CKEditor 5?
th flag

How do I add <i> in CKeditor 5 without hacking a core module?

In Text formats and editor, for the allowed HTML tags, the following text is shown-

With CKEditor 5 this is a read-only field. The allowed HTML tags and attributes are determined by the CKEditor 5 configuration. Manually removing tags would break enabled functionality, and any manually added tags would be removed by CKEditor 5 on render. ...

Score: 0
Eric MORAND avatar
How do I install the database drivers?
ru flag

I'm trying to use Drupal 9 framework, and I'm stuck when setting up the database: I get the infamous error Error: Class 'Drupal\pgsql\Driver\Database\pgsql\Connection' not found.

When looking at the Drupal Core module composer.json, I see that the module expects a drivers directory to exist under vendor/drupal:

"autoload": {
        "psr-4": {
            "Drupal\\Core\\": "lib/Drupal/Core",
         ...
Score: 2
sidgrafix avatar
Is there a simple way to add a core themes css file to your custom theme?
rw flag

Is there a way to declare a css dependency in a custom themes libraries.yml similar to adding core js dependencies?

If I can avoid it, I'd rather not just copy a core themes css into my custom theme in Drupal 9 (more specifically latest Drupal 9.5.2)

I tried under dependencies to add a css file from a core theme but it doesn't do anything. So I'm guessing that isn't the way to do it or I wrote it in ...

Score: 0
Zeroplexer avatar
ReCaptcha doesn't show on Simplenews Subscription Block
fi flag

I have the subscription form of Simplenews in the footer, which should be protected with reCaptcha. I installed reCaptcha and created a captcha point with the form ID of the Simplenews block. Unfortunately, I don't see the recaptcha on the Simplenews registration block in the footer.

What am I doing wrong?

Score: 0
How to sort the views by a column from a custom database table?
kr flag

I have a custom database table my_apps.

This table has nid and uid columns.

I have created a view, which is displaying some nodes. I want to sort this view from that custom table.

Like ORDER BY COUNT(uid from my_apps) where nid={nid from my_apps}

Is this possible?

I tried this module Views custom table but then you have to create the view based on that table instead of a content view. And I don't want ...

Score: 1
How do I document union type variables?
ru flag

My module has a class with a union type member variable

/**
 * This is a PHPv8 union type variable that can be a string OR null.
 *
 * @var string|null
 */
protected string|null $myVar;

However, when I run the code sniffer with phpcs --standard=Drupal,DrupalPractice ..., I'm always getting an error like

FILE: MyDummyClass.php
----------------------
FOUND 1 ERROR
----------------------
  46 | ERROR   | M ...
Score: 2
Matt avatar
How to programmatically invalidate the cache of every node
cn flag

I have a form submit function that is meant to invalidate the cache of every node if a specific field is altered. Here's how I'm attempting it.

$config = $this->configFactory
  ->getEditable('my_config.settings')
  ->get();
if ($form_state->getValue('global')['header_button'] != $config['global']['header_button']){
  // Header Button Changed
  \Drupal\Core\Cache\Cache::invalidateTags([' ...
Score: 2
Lambic avatar
Setting SameSite=None on a session cookie
ph flag

I have a custom endpoint which stores a value in a session cookie, using this code:

$session = $this->request->getCurrentRequest()->getSession();
$session->set('test.email', $data['email']);

I'm calling this endpoint from a decoupled frontend.

This works fine in Firefox, but in Chrome it looks like the session cookie is being blocked because SameSite is set to Lax. How would I set SameSite to ...

Score: 0
hotwebmatter avatar
Convert Drupal 8.6 site to Composer (after D8 end of life)?
nr flag

Client has a sqldump and a tarball of a broken Drupal site.

Instead of using Composer to set up the recommended project, it looks like the previous developer performed a git checkout of http://git.drupal.org/project/drupal circa Drupal 8.6.15 :anguished:.

I'd like to Composerize the project before attempting to update Drupal from D8 to D9, but it looks like I can no longer composer require "drupal ...

Score: 0
Patoshi パトシ avatar
Proper usage of Webform 6.x + webform_validation 2.x with conditional statements
kr flag

I'm on Drupal 9.4 with webform 6.x. The webform validation module is a bit confusing and I couldn't get the conditional statements to work properly. Below is my configuration. I have a hidden field and I want to populate this field with the duration the user is on the page when 5 seconds has passed with 5000 for milliseconds. From there I want to setup a webform condition to see if the number in this fi ...

Score: 0
Wayne Foster avatar
How can I alter the response headers for error pages?
in flag

Same question as a few years back for Drupal7 - but the offline maintenance page seems a little different in Drupal 8/9/10 - and still a work in progress:

https://www.drupal.org/project/drupal/issues/2720109

We have Cloudflare sitting in front of our Drupal sites - and in order to take advantage of their "AlwaysOnline" feature - we need to alter the response code sent in the event of an error - we ne ...

Score: 0
vctlzac avatar
Migrate webform directory with Composer from manual installation
in flag

I'm started drupal project (core 9.5.2) installing modules manually (it is not good, i know). After the website is deployed in production, I made changes for configuring composer and all worked well.

As new versions of modules come out, I install them through composer. I use composer require (and the module is installed in /modules/contrib) and then I remove the module folder in /modules, clear t ...

Score: 0
Quentin avatar
How can I send a multipart/post-data POST request via a resource controller?
um flag

By trying to create a custom REST API through a resource controller via a custom module in Drupal 9, I would like to be able to send my data from a multipart/form-data Content-Type in order to pass files along with my textual data.

To be more precise, I have a Drupal content type with different text fields and with the possibility for the user to add attachments.

Currently I can only use a JSON form ...

Score: 0
mauzilla avatar
Translation destination email handler
cn flag

I have a multi-language site with a webform contact form. Everything works, I can setup different translations, shows perfectly. I want to however change the "to" address per language. When I create a translation, the WEBFORM HANDLERS has an email section, but the email section does not contain a "to" field, leading me to believe all webforms for that form, regardless of the language / translation, can  ...

Score: 0
Rayan Frem avatar
Exposed Filters Manipulation and product attributes
cn flag

I am using Better exposed filters in my view and the filtering criteria are Product Attributes of the Product Variations i have setup. It is working but the attributes are showing as Titles and i would like to show them as pictures(Field image is already available and the needed display mode too). Is there any module or way to replace the default behavior of showing titles by showing one of the fields o ...

Score: 0
NicklasF avatar
AJAX on Form Details
us flag

I have a lot of API calls in a form, so in order to not call everything on load, I only want to load it when the user opens the details element.

But I am having trouble adding #ajax to the element. I can see a spinner and that it calls buildForm(), but it is not triggering the callback method. When I wrap the ajax part inside e.g. an checkbox, it works. Thus, I come to the conclusion that it is s ...

Score: 0
rfmarcelino avatar
How show field labels in the node display even if it's empty
cn flag

While showing a node, only the filled fields are rendered. I wanted to be able to show the empty field labels, and I was looking for something like the ability to uncheck an option such as 'Hide if empty' or check a 'Display even if empty.'. Unfortunately, there are no such options. In order to display them, I used a hook_preprocess_node:

/**
 * Implements hook_preprocess_node().
 */
function MYMOD ...
Score: 2
Views aggregation of content values across two columns
us flag

I have a test content type that has a test name (A or B) and whether the Test is a pre-test or a post-test. Given the following data from that content type:

Test Type
A Pre
A Pre
A Post
B Pre
B Post
B Post

I am able to use Views aggregation to get the total number of each Survey, or total by type across two rows:

Survey Type Total
A Pre 2
A Post 1

But I am trying to  ...

Score: 1
Benoit avatar
path alias OK for default language, but no alias for others
nl flag

My site is in D9, mainly in French, with some pages in English.

I have an old page (note 553 written in D6 in 2017), which can be correctly accessed in French with https://mysite/myoldpage and in English with https://mysite/en/myoldpage.

I've just written a new page in French (https://mysite/mynewpage) and translated it in English. But the translated page is only accessible with https://mysite/en/no ...

Score: 0
Tomáš Bažant avatar
Error about non-existing configuration
de flag

After trying to import configuration with drush cim it returns an error saying

The import failed due to the following reasons:
Configuration core.entity_view_display.contact_message.kontaktujte_nas.default depends on the field.
field.contact_message.kontaktujte_nas.layout_builder__layout configuration that will not exist after import.

What am I doing wrong?

Score: 0
JPcode avatar
How to POST file with JSON:API in /jsonapi/file/file?
gw flag

I tried with POSTMAN to upload a file to my endpoint host/jsonapi/file/file, the POST method is available but when I try to upload something, drupal gives me a 415 unsupported media type error. I tried with the binary option and with the data-form option using the next headers:

"Accept: application/vnd.api+json"
"Content-Type: application/octet-stream"
'Content-Disposition: file; filename="test.jpg ...
Score: 0
Dynamicaly add ajax form item and add event on checkbox
kn flag

I've added an ajax callback to my form to add some data on it :

$form['add'] = [
    '#type' => 'button',
    '#value' => t('add'),
    '#ajax' => [
        'callback' => [$this, 'ajaxFormAdd'],
        'event' => 'click',
        'wrapper' => 'contacts',
        'progress' => [
            'type' => 'throbber',
            'message' => $this->t('Ajout d\'un contact... ...
Score: 0
Vitaliy K avatar
Upgrade report shows Invalid permissions will trigger runtime exceptions
tr flag

Preparing my Drupal 9.5.1 website to go on Drupal 10. I have installed module Upgrade status.

getting in report this kind of error :

Invalid permissions will trigger runtime exceptions in Drupal 10. Permissions should be defined in a permissions.yml file or a permission callback.

most of the permissions is for background image module, Paragraphs, Flag.

I've found closest answer for this. Like a patch to b ...

Score: 0
R. Geerolf avatar
Cannot set #return_value for Webform checkbox in custom webform composite
ca flag

For a checkbox webform element, there is a property '#return_value' so you can return another value than 'TRUE' if the checkbox is checked. I cannot set this property in a custom webform composite I build programmatically (extending WebformCompositeBase). I still get returned 'true' in my submission data. If i create the checkbox in a composite build with the UI everything works. So I think I'm doing so ...

Score: 3
Moved an old installation profile now site is broken
do flag

I have a d9 site with an old installation profile originally written for d8.

I was having some issues with the profile preventing the uninstallation of some modules so I tried moving the entire folder for a moment to see if that removed the profile.

Instead, it broke (WoD) the site. I moved the profile directory right back where it was but no matter what I do the site remains WoD with the message: ...

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.