Latest Drupal related questions

Score: 2
How to add Rabbit Hole to a custom content entity
kp flag

We use the module Rabbit Hole for nodes and terms. Now we would like to use it also for our custom content entities. I have tried to find some information, how to add the Rabbit Hole to a custom content entity. I have found some related information, but maybe there is some manual, which would be more specific.

I have found:

Score: 0
mt.i.1 avatar
Geofield map : add marker on click listener
us flag

I've added a google map which I feed thanks to the Geofield module.

I'd like to add an onClick event to each marker to have a custom behavior.

this is what I've done this far :

  Drupal.behaviors.geofieldGoogleMapInteraction = {
    attach: function (context, settings) {
      if (context !== document) {

      // React on geofieldMapInit event.
      $(document).on('geofieldMapIn ...
Score: 1
How to translate the layout builder blocks of a node programmatically?
kr flag

I am translating the nodes programmatically. Everything works fine except the layout builder blocks.

When I try to translate it, it also changes on the source node.

I have created a node in language en. Now I am translating it to nl. Here is my code.

if ($node->hasTranslation($language)) {
  $translated_entity =  $node->getTranslation($language);
else {
  $translated_entity =  $entity->a ...
Score: 1
Import content in nodes with media:image fields using Migrate from csv source
mx flag

I try to import content from a .csv file into article nodes of a fresh D9 install using Migrate, Migrate Plus, Migrate Tools, Migrate csv source and Migrate File (extended)

My article content type has a field_article_media_image expecting a media image item.

When I run the migration, the articles are created correctly BUT the field_article_media_image is still empty. I see the image has been import ...

Score: 1
Sarah C avatar
URL aliases for non-translated content types revert to /es/node/nid in menu
za flag

I have Content Translate enabled and enabled translation on only our Projects content type. I've placed the Language switcher block on a Projects view and Project node page. This is working just fine.

My problem is, if I use the Language switcher on the Projects view for Project page, then click a link in the main menu to a pieces of non-Project content, the path has changed to /es/node/1 when it should ...

Score: 0
How can I create a notification entity with Rules module
br flag

I have installed a notification system and I want to create notifications with Rules when a project content is updated to waiting for approval status.

The rule looks like this:

uuid: 3165768f-15f5-4c35-a7e6-3f862b526f10
langcode: en
status: true
dependencies: {  }
id: project_updated
label: 'Project updated'
    event_name: 'rules_entity_update:node--project'
description: ''
tags: {  }
con ...
Score: 0
Abdul Sadik Yalcin avatar
Getting 403 randomly on files
ag flag

I have a react-native app that authenticates with Drupal via oAuth2 (simple_oauth, openidconnect) and do not use cookies. I use my access token for all rest calls, images and other files. Very randomly and consistently, the response for the files are html - the login form to be precise. Not all files but some of them and randomly. Sometime it works, sometimes it doesn't. If I logout and login again, it w ...

Score: 2
quantumized avatar
How can I retain the destination parameter when a user registers a new account with email verification?
ng flag

This is for a Drupal 9 website.

How can we retain the destination after a user registers a new account that requires email verification?

Example workflow:

User clicks to create a new node but does not have permissions.

They are present with the registration page where the destination parameter is set from the previous content/add URL.

They fill in and submit the form and are instructed to check the ...

Score: 0
Need help with AJAX calls within Drupal.behaviors
in flag

I'm having some issues getting the following code to work correctly:

(function($) {
'use strict';
Drupal.behaviors.mybehavior = {
    attach: function(context, settings) {

        // Click on a placeholder image, this should open a form and then
        // replace the image with a video resource (gated content)
        $(document).once('abc').on('click', '.image_class', function() {
            va ...
Score: 0
Geat avatar
Content and content type fields intermittently disappear after cache rebuild
de flag

I have an issue on a Drupal 9 website where sometimes (but not every time), if I run drush cr the content of pages disappears (the header and footer are all that remain), and in Structure > Content Types all of the fields are missing from the page content type.

A second cache rebuild, or even a standard Drupal cache clear, always solves the problem.

I don't want to go into production until this ...

Score: 0
Jorn Reed avatar
Creating twig files for the a view
il flag

Hi there I'm new to Drupal. I have made a test project, where I've made a custom content-type called 'persons' it has a couple of values. And I made it able to custom style it by making a twig file called 'node--persons.html.twig'. Now I have built a listing view, where I loop through all the 'persons'. It's called 'People view' But I can't get it to work to make a working twig file that is able to prop ...

Score: 1
Ludo Parazoom avatar
Webform handler to manage number of places available
cn flag

I want to manage a webform to automatically close it if number of people reached, or to invalid submission if not enough places are available.

I have use this : Close a webform when total seats reach a maximum to try to make a handler

here is my code :

namespace Drupal\webform_reservations\Plugin\WebformHandler;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformHandlerBas ...
Score: 0
Disable form element depending on media image dimensions
in flag

I have paragraph that contains one media image field and one checkbox field. What I need is to disable that checkbox if selected image media is less then X pixels wide. So it should work when paragraph is opened for editing and also react if image is changed during paragraph editing. How can I achieve that? Is there some event which reacts on media image being changed that can be attached to form?

Score: 0
Get all entity reference options from a field name
in flag

I would like to create a node programatically and one field field_supervisors has an entity reference field for the node type People.

In order to set the correct entity reference information I need to set:

  ["target_id" => 1],
  ["target_id" => 2],
  // etc..

How can I get the individual id of the entity reference from the field_supervisors. Do I really need to look up the node People

Score: 0
The "node" parameter was not converted for the path "/node/{node}"
tr flag

I have the following error in the filters with parameters in view type pages. will there be any solution to this problem?

Drupal\Core\ParamConverter\ParamNotConvertedException: The "node" parameter was not converted for the path "/node/{node}" (route name: "entity.node.canonical") in Drupal\Core\ParamConverter\ParamConverterManager->convert() (line 104 of /var/www/html/web/core/lib/Drupal/Core/P ...
Score: 1
How to display all data from a paragraph field in views (Drupal 7)
ae flag

I am currently a caretaker for a Drupal 7 website and I can't figure out how to group paragraph items in views. I have created a content type Products and one of the fields is called product variation which is field type paragraphs. I have created a paragraph bundle for that field.

Then I created a view to show the products on the front page. To display the paragraph fields I created a content re ...

Score: 0
JaSiMi avatar
Drupal7 Views relationship multi value custom column
bo flag

Im using Drupal7 and views, views relationship

Im displaying the results in table format with the help of view along with other custom tables as well as by using views relationship.

I need a help in below issue:

I have a custom table: employee

Columns: nid, uid, role

nid uid role
100 4 manager
100 5 dept-manager
100 6 assistant
100 7 manager2

In the table format of the view, I need  ...

Score: 0
Sudheesh S Babu avatar
How to get the base URL of a site in Queue API?
co flag

I am trying to get the base url of the drupal 8 website in a queue process but I am getting http://default as the base url. What am I missing here?

  public function testUrl() {
    global $base_url;
    $host = \Drupal::request()->getSchemeAndHttpHost();
    var_dump($host); // output - http://default
    $host2 = \Drupal::request()->getHost();
    var_dump($host2);  ...
Score: -1
OmarAc avatar
Webform 6.1.0 help text not showing
us flag

I updated my webform Module from 5.3.0 to 6.1.0,

I have one the Following Error: the help text isn't displaying its content on any form on my site (Example of help icon in the shared image) help icon

It should return the following when i do the mouseover: wanted result

I tried:

  • searching on google: no clear solution
  • changing the css and js file persmissions to 777
  • looked into my console: no return when i do mouseover o ...
Score: 1
FooBar avatar
Migration away from Open Atrium
cn flag

We have an intranet site running on Open Atrium (A product which has not been supported or updated in some time) and would like to migrate to a Vanilla Drupal install on either 8 or 9.

We do not use any custom code (we do use a few additional modules, which as far as I can tell are supported in at least 8.x).

Is there an accepted method for doing this?

I have tried disabling all the OA modules and then ...

Score: 1
Attempting to return region in theme suggestions for the book module book tree block
cn flag

Editing question based on information from @NoSssweat

The book module uses the same hook for the book tree block and the rendered index view in the book page.

I have used the below code to return file name suggestions, so that I can override the html output for the book tree block in a specific region - "sidebar-first". I expected the below code would spit out something like book-tree--book-toc-180--sid ...

Score: 0
View injecting weird html elements (b element)
in flag

I've noticed recently that, in a drupal website I'm maintaining, a view displaying a list of content type called Event, has some weird html elements injected. This messed up the layout and I'm not sure what caused it.

The element injected is <b data-stringify-type="bold">, which is placed inside the views-row element.

I'm wondering, is someone of you already encountered this? I haven't found a way ...

Score: 0
Node access based on the user reference field
mx flag

I have a content type that is used for temporary access. The node is created and has an expiration date; it's deleted after that date. On this node there is a user reference field; only the users added to this field should have access to viewing this node. I can't find a hook to handle this access. In Drupal 7 I used hook_node_access(), but it doesn't seem to exist for Drupal 9.

The only information I'm ...

Score: 1
liquidcms avatar
How to alter Layout Builder block visiblity?
us flag

Is there a hook to alter block access for blocks placed using Layout Builder? I see there is hook_block_access; but sadly this is not triggered when the block is placed using Layout Builder.

There is also work going on here: to allow standard block visibility settings to be made available to Layout Builder blocks; but this only all ...

Score: 0
Bulk assign content to Book
cn flag

I've decided to reorganize my site to use the book module. How do I bulk move specific content types to be children of a book?

Bulk Update Fields doesn't include the Book meta data, so I am unable to update that way.

Score: 0
Warning when repeating migrate:import process
in flag

I created source and data process plugins for mongo db. And when I run import for the first time it works well. But if I run it again, immediately after that I get warning:

[warning] Could not load the following items on index Content index: "entity:node/104:en", "entity:node/105:en", "entity:node/106:en", "entity:node/107:en", "entity:node/108:en".

Where those are the ids of previously imported nodes ...

Score: 2
Giuseppe avatar
How get the view mode\third_party_settings of a field inside hook_preprocess_image_formatter(&$variables)
br flag

I'm on D9.

I've added a custom option to the image field formatter following Drupal guidelines

In the preprocess of the field I can get the settings I've created:

function my_module_preprocess_field(&$variables) {
  if ($variables["element"]["#formatter"] === 'image') {
    $entity = $variables['element']['#object'];
    $view_mode = $variables['element']['#view_mode'];
    $field_name = $variables[' ...
Score: -2
Matoeil avatar
how to import 3 xml selectors in one drupal field using the migrate plus module?
za flag

the migrate_plus migration conf i had so far was

  title: title
  body: job_description
  field_job_diffusion: offer_type
  field_job_statut: statut
  field_job_domaine: domaine
  field_job_campus: campus
  field_job_niveau_etudes: study_level
  field_job_emailapi: application_email

It works for single XML selector to single field mapping and migration. I need now to get the value from 3 ...

Score: 0
andileco avatar
How can one programmatically get the bundle constraint for an entity reference field?
rs flag

I'm working in the context of a Views plugin. I have $entity_type and $field, as required in the snippet below. How can I get the bundle constraint for the entity reference field programmatically?

/** @var Drupal\field\Entity\FieldStorageConfig $field_configuration */
$field_configuration = FieldStorageConfig::loadByName($entity_type, $field);

$field_configuration->getType() gives me "entity_referen ...

Score: 2
How to create a view that lists all taxonomy terms of a vocabulary, filtered by a term id?
cn flag

I have a lot of different vocabularies. On The taxonomy page (the standard view provided) I would like to add a block (view) that takes the current taxonomy id from the url/page and displays all taxonomy terms belonging to the same vocabulary. I tried adding a contextual filter, but when I choose term id from url, the view only shows one term, but I would like to show all terms of the vocabulary the ter ...

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.