Latest Drupal related questions

Score: 0
Pankaj Sachdeva avatar
format_p config not working with CKEditor
us flag

I am using D9 and using CKEditor for a formatted long field. Currently enterMode = 1 is set which means by default we will have <p> tag in every new line. We only have 3 enterMode in CKEditor:

enterMode = 1 -> p
enterMode =2 -> br
enterMode = 3 -> div

I have a requirement to convert this <p> tag to <span> tag. I have tried to set achieve this by using

function it_common_e ...
Score: 1
CanardPpc avatar
Migrate Medias update : entity_lookup process error
de flag

I'm trying to update Medias already existing in my Drupal using Migrate and the process entity_lookup.
The field field_uuid was designed specifically as a matcher for my .json original datas and the already imported Medias. The process inside my .yml migration file looks like this :

process:
  mid:
    plugin: entity_lookup
    source: uuid
    entity_type: media
    bundle: audio
    value_key: ...
Score: -2
New Dev avatar
get node id from entityQuery('node')
np flag

I want to get the node id from entityQuery('node') the below query give me array vid = nid

$nids = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'account_content')
->condition('field_account_id', $accountid)
->execute();

When using array_keys($nids) // getting vid which is revision id

When using array_values($nids) // getting nid which is node id

I want the n ...

Score: 0
How to render a Taxonomy Term in twig without the term name?
au flag

For some reason, I am writing my own controller that needs to include a taxonomy term.

I want to render everything of a taxonomy term (except the name / title) in the template I wrote.

My controller is like this:

use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase {

  /**
   * Drupal\Core\Entity\EntityTypeManagerInterface definition.
   *
   * @var \Drupal\Core\ ...
Score: 1
Patoshi パトシ avatar
Exposed Views Filter of Usernames in a list instead of autocomplete
kr flag

I have an exposed filter with a relationship to a reference field in my content type to users. Currently this exposed filter lets me filter by inputting a username, but its only autocomplete. Is there a way to have a select list of usernames I can pick from?

enter image description here

Score: 0
Patoshi パトシ avatar
Views Exposed filter can't input username to filter. Only works with User ID
kr flag

I created a custom View, where it shows all of a specific content type. In this content type I have a field that is a user reference called "Assigned to". In this view, I want it exposed so one can search by a username, but this exposed filter only takes in the User ID, but not the user name. What am I missing to make this work?

I added a relationship of User:Assigned_To and that didn't seem to w ...

Score: 0
tsitsi avatar
Taxonomy field not displaying in a Node built with Paragraphs
ao flag

I have a node type called Profile. It includes a paragraph type called Person. The fields in that paragraph type are:

  • Name (text)
  • City (taxonomy field)
  • Brief (text).

Whenever I look at a published Profile page without logging in, I can see name and brief the taxonomy field is not displayed. However, when I log in, I can see the full node with the taxonomy field.

It feels like a permissions issue,  ...

Score: 0
Chuck Norris avatar
Perform an LDAP search from a module
ua flag

I am trying to perform an LDAP search from hook_form_validation() in a webform using Drupal 9 and drupal/ldap 4.3.

I have configured the LDAP module on my site, but I am not using it for authentication. I can however use ldap query and perform a test of the ldap server on /admin/config/people/ldap/server successfully.

At the bottom of API usage they say you can use the following code.

$factory =  ...
Score: 1
Why does this custom CKEditor plugin produce the toolbarview-item-unavailable error?
pt flag

I have 2 modules in active development with the purpose of learning how to develop custom plugins for the Ckeditor5 wysiwyg.

On both modules, I am stuck on the following problem. The error pasted below is from the second module :

ckeditor5-dll.js?v=35.4.0:5 toolbarview-item-unavailable {item: 'testPlugin'} 
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-toolbarvie ...
Score: 0
jackrabbithanna avatar
JSONAPI - limit list of included referenced entities via filter
ke flag

I'm using JSON API and JSON API Include modules, in Drupal 9.5

I've got a node type, "article" with a entity reference revisions field referencing a paragraphs, field name, field_variant. So this call works great, gives me all information: https://mysite.com/jsonapi/node/article?include=field_variant&jsonapi_include=1

What I'd like to do is have a filter, which returns all nodes of the type,  ...

Score: 0
tawellman avatar
Converting Node Type to New ECK Content Type
us flag

I have a site with several different Node Types. With some of them having different types within them created with a Text(list) fields.

For Example:

Node Content Type: Chemicals
Label: Chemical Type Machine Name: field_chemical_type Field type: List (text)
  Allowed Values list:
      fertilizer|Fertilizer
      fungicide|Fungicide
      herbicide|Herbicide
      insect ...

Score: 1
Travis avatar
Form builder not getting checkbox values
cn flag

I cannot determine why the form state seems to fail to get the values of the checkboxes on a form I'm building.

In my buildForm(), after submission, I am returning a result set. Each result that is built includes a checkbox form element.

$form['main_container']['grid'] = [ 
  '#type' => 'container',
];    

foreach ($title_list as $title => $row) {

  //...some code here...
  
  $form['main_c ...
Score: 0
Pankaj Sachdeva avatar
Entity Print - Getting error while clicking on View PDF
us flag

I am using Entity Print module and I didn't change its default configs. enter image description here

I am using Dompdf library for generating PDF on node. I have enabled View PDF from Manage Display page. When I am clicking on View PDF to generate, I am getting this error:

Error generating document: Failed to generate PDF: file_get_contents(http://dots-eco-drupal.docker.amazee.io/sites/default/files/css/css_Hj6dvEdQZTchfggjP ...
Score: 0
Fetch select label via GraphQL
cn flag

My nodes have an "articleType" property, which is a select field with ~10 options ("article|Article", "training|Web based training" etc).

Fetching the property via GraphQL (8.x-3.1) works, but this gives me the key of the selected option (training):

    [...]
    results {
      entityLabel
      ...on NodeArticle {
        fieldArticleType
      }
    }
    [...]

I would like to retrieve the label of  ...

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 ...

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.