Latest Drupal related questions

Score: 0
Drupal 9 core multilingual: cannot translate main navigation menu - button translate missing on menu items
cn flag

I'm trying to catch multilingual features of Drupal 9 and have wamp64 local development server and clean Drupal 9.2.8 install.

I've enabled 4 multilingual core modules:

  • Configuration Translation,
  • Content Translation,
  • Interface Translation,
  • and Language.

Two languages enabled: en and ru.

I'm trying to translate Main Navigation Menu, but menu items don't have a "translate" button along with "edit" ...

Score: 0
How to keep Contextual Filters (query) on Exposed Filter change
nl flag

I have a view page that leverages Contextual Filters with query parameters. So when a user visits the view page, the URL is as such… /search?location=san+francisco. This works as expected.

Now there are 3 exposed filters for this same view. When the user selects an exposed filter, the above contextual query parameters are replaced with the exposed filter parameters, as such /search?weather=cloud ...

Score: -1
Matoeil avatar
Migrating date into drupal datetime field
za flag

i am having the xml selector

<starting_date><![CDATA[ 2017-01-01 22:34:56 +0100 ]]></starting_date>

this migration process fails :

process:
  field_job_starting_date:
    plugin: format_date
    source: starting_date
    from_format: 'Y-m-j H:i:s Z'
    to_format: 'Y-m-d\TH:i:s'
    to_timezone: 'Europe/Paris'

How can i fix it ?

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) {
        return;
      }

      // 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'
events:
  -
    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 :

<?php
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?

 ...

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.