Latest Drupal related questions

Score: -1
View with multiple blocks, how to specify which is shown?
ph flag

I have a view that is placed as a block below my main content. Within that view I have block "displays". each having a different contextual filter for their id from url.

The problem is when the view is displayed, it only shows one of the Displays, how do i specify which is shown ?

enter image description here

Score: 0
I get a block that doesn't change on other pages
us flag

I have an issue with the contextual filters when I use Content: ID. On the site I get a repetitive, when there are many more recipes.

The block remains the same, with two recipes, which is fine, but they don't change on another page. It's always the same.

I hope this makes sense.

Recipes

Block

Contextual Filter

Recipes

Main Issue

Score: 1
Kevin avatar
Edit a node in the settings tray?
in flag

I am looking at this page in the Drupal docs for the Settings Tray and wondering if this can be used to edit the current node you are looking at, similar to this image:

enter image description here

Is there a way to edit all of the nodes fields from one tray? Is it expected that you would use QuickEdit (which is being discussed as being removed from core) to do this? What if there are fields that are not visible but you stil ...

Score: 3
chantdev avatar
Can BigPipe exclude certain blocks?
et flag

I've got BigPipe enabled in Drupal 8, and it helps to make pages initially load faster.

However, the header block is always one of the blocks that loads in on a delay, which visually looks bad since the content shifts down afterwards.

Is there any type of preprocess on a block to exclude it from BigPipe not be loaded on a delay, and force it to be in the initial page load?

Many thanks.

Score: -2
everapt avatar
Is the module fully compatible with Drupal 9?
cn flag

If I create a new project and install The Commerce Core module using Composer following the instructions given from the drupalcommerce.org documentation, it would install Drupal 8 by default, not Drupal 9.

I know there are ways to work around this and install Commerce Core on top of Drupal 9. Is it fully compatible with Drupal 9?

Score: 2
sonfd avatar
In the context of a multilingual site, what is considered "interface text" and what is "content"?
in flag

On the Language Selection and Detection configuration page (in the toolbar, Manage > Configuration > Regional and language > Languages > Selection and Detection), I see that I can detect and set "Interface text language" and "Content language" differently. But I don't see a clear definition of those terms anywhere.

I have a hardcoded heading within a node template:

<h2>{{ "Hello worl ...
Score: 0
Composer require installation profile constraint match error
us flag

I am trying to download this install profile https://github.com/UH-StudentServices/student_guide

I added it to composer.json like this

"repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "vcs",
            "url": "git@github.com:UH-StudentServices/student_guide.git"
        }
    ],

Then I did composer ...

Score: 0
Joehoe avatar
A specified library is missing
tr flag

On a custom theme "foobar" (based on Olivero) this error message occured. This custom theme is a copy of drupals 9.2.2 olivero's theme.

Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException: The specified library "foobar/cke-dialog" does not exist. in Drupal\Core\Asset\LibraryDiscoveryCollector->applyLibrariesExtend() (line 154 of core/lib/Drupal/Core/Asset/LibraryDiscoveryCollecto ...

Score: 0
Corentin Le Fur avatar
setError or setRebuilld methods breaks validation form
vn flag
<?php

namespace Drupal\my_custom_module\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Class DefaultForm.
 */
class DefaultForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'default_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $fo ...
Score: 0
Ivan Ginovski avatar
Display Node Local Tasks Menu on View
jp flag

I have a view that shows registrations for an Event (Content Type). This tab is shown in the /node/{node}/edit:

menuregistrations

This registrations tab refers to the view, which I have inserted in the routing.yml:

events.registrations:
  path: '/node/{node}/registrations'
  defaults:
    _entity_view: 'registrations.page_1'
  requirements:
    _custom_access: '\Drupal\events\Access\EventsRegistrationsAccess::checkAcc ...
Score: 2
jhnc avatar
correct way to access node-revision change property in twig
cn flag

I have a Drupal 8.9.17 website. My theme (based on Garland) includes in templates/page.html.twig:

{% if node %}
[...]
Last updated {{ node.changed.value|format_date('custom', 'D M d Y') }}
[...]
{% endif %}

This displays the property when viewing nodes at: /node/<nid>

However, when attempting to view revisions at /node/<nid>/revisions/<vid>/view, format_date() fails with "null times ...

Score: 0
deelite avatar
"block_name" not found
cn flag

I installed the Twig Tweak module.

{{ drupal_block('block_name') }}

doesn't work. In Drupal logs I get the error

The "block_name" was not found

"block_name" I get from the config url of the block config page

admin/structure/block/manage/block_name?destination=/de/admin/structure/block

Do I do anything wrong?

Score: 0
Let anonymous user download pdf off his own webform submission
ng flag

I have configured entity_print with webform for D8 and can download a submission as pdf from the submission view.
Now I tried to let anonymous users fill out a form and added a link to the pdf on the confirmation page. I checked the show own submissions for guests on the permission page of that webform.
But when I try to access the pdf with the submited data I get a permission denied message.
http://m ...

Score: 0
scaffolding avatar
Updated: Webform tokens present user-submitted data for form fields
es flag

I'm attempting to build a webform (Webform 8.x, Drupal 8) that requires the ability for a user to submit the form multiple times.

To simplify the process for users, I'd like to set up some form fields to:

  • be empty by on their first visit to the form
  • for subsequent renders of the form, some form fields should be prepopulated with submissions from the previous submission

Is there a way to achieve this  ...

Score: 0
latikas avatar
Migrate nodes with Paragraph from json
ru flag

My goal is to import json file into Drupal 8 using Migrate modules (migrate_plus, migrate_tools). I use Paragraph module with fields like Name (entity reference) and composition (Number-float). And in node, I have title and other fields with Paragraph reference field. I do import, sometimes the node will be generated with blank paragraph name, If I reset migrate and try to import again, db logs gives fo ...

Score: 0
Editing media for content editor results in a 404
ve flag

We have a custom role, location_editor, which is assigned to users who can only manage media and one content type.

These are the role's media permissions.

screenshot

And if the user now tries to enter any valid media edit url (for example /media/35/edit - which does exist and was created by him), the result is a 404. The admin user can edit it just fine. The user can also access /media/35/delete without problems. ...

Score: 0
Interlated avatar
How do I debug overridden twig templates?
km flag

How do I debug the template overrides. The debugger stops on page.html.twig but doesn't stop on sub templates such as

web/themes/custom/localtheme/templates/field--paragraph--field-pbcrossfade-image--crossfade-banner.html.twig

The page.html.twig breaks here

enter image description here

The debugger does not break in the sub template.

enter image description here

Score: 0
If I am using PrivateTempStoreFactory, should I be using the Internal Page Cache Module?
pk flag

I found a Stack Exchange question here that kind of answers this question, but I was not clear about the answer from the exchange in the comments. Regardless of the reason I am using PrivateTempStoreFactory, should I avoid using the Internal Page Cache module if my site uses a custom module that uses PrivateTempStoreFactory?

Score: 1
Anthony Tailor avatar
Disable source code formatting in CkEditor
ua flag

In Drupal 9, is there a way to avoid CkEditor re-formats the source code?

There is one text editing mode set in Drupal, Full HTML. When I edit or create a Basic page node, once I click the Source button, paste in code, deselect Source, and then re-select Source, the formatted code becomes CkEditor-ified.

I only found posts from years ago or that aren't for Drupal 9. I've tried the CkEditor Config modul ...

Score: 0
hotwebmatter avatar
Template preprocess to generate Font Awesome markup for menu links
nr flag

In Drupal 9, I need the ability to prepend Font Awesome icons to menu links.

I have attached Font Awesome 5 JS and CSS assets to my theme via *.libraries.yml.

If I open a menu link in the DOM inspector and edit the markup of a link from this:

<ul class="clearfix nav">
  <li class="nav-item">
    <a href="#comments" class="nav-link nav-link-comments">Comments</a>
  </li>
&l ...
Score: 1
Chris Roditis avatar
Ajax form inside custom system.404 route controller doesn't work
in flag

I need to display custom logic in 404 pages so I have overridden the route controller of the system.404 route like this:

class RouteSubscriber extends RouteSubscriberBase {

  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('system.404')) {
      $route->setDefault('_controller', '\Drupal\mymodule\Controller\myController::on404');
    }
  }
}
Score: 0
user3108268 avatar
Set a Data Value from Text field to Term Reference field
us flag

Node has two fields:

  1. Text field
  2. Term reference field (autocomplete?)

The Text field is old and already has 500 nodes with 500 unique values.

The Term reference field is new and needs to contain same data.

So e.g. one node has Text field value of 123, the Term reference field also needs somehow to have it set to 123?

enter image description here

In Rules Set a value data only lets you copy content from term reference field ...

Score: 0
Rog Boy avatar
Checkbox Ajax call back giving me error
ma flag

New to drupal 7, following code should work fine according to my knowledge can someone help me why ajax give me error in console ? and what the solution

Code

function user_activity_tree_structure_showoptional_form($form, &$form_state, $base_nid) {
      $form['enablecond'] = array(
        '#type' => 'checkbox',
        '#title' => "Checkbox  ",
        '#ajax' => array(
        'callba ...
Score: 0
Interlated avatar
How do you add a CSS class if the default field value is chosen?
km flag

How do you identify that the default taxonomy field choice has been chosen?

Solution consists of a taxonomy list. If the default is chosen the title in the display should be hidden.

Using views to display the list.

Score: 1
berliner avatar
How to create automatic url alias for taxonomy/term/%tid/feed
bd flag

How can I set automatic URL aliases for taxonomy feeds?

Say I have a term with tid=1, named holidays, with a system URL of /taxonomy/term/1 that is accessible by the URL alias /holidays. Then I want the rss feed for that term to be accessible on the URL alias /holidays/feed or /holidays/rss.xml. That sounded rather easy when I first thought about it, but it seems that pathauto is not supporting that (o ...

Score: -1
José Luis avatar
Insert PHP snippets in content
in flag

Drupal 9 doesn't have the PHP Filter module in core. I need to insert PHP snippets in the content editor (for example a Twig variable).

Is there any way to insert PHP snippets in Drupal content?

Score: 0
gmak avatar
Pass a value via URL to a node edit form and use it to redirect after saving the node
cn flag

I have a node that includes a series of embedded views. When displaying, I have to pass a value via URL arguments (http://example.org/node/x?id=y), so that the views can get the appropriate information. The user needs to be able to edit this node, but when they save and return to the node it has lost the id=y part and the display is incomplete.

I know I can use hook_form_alter() to redirect, but I ...

Score: 1
How to determine which password hash is used?
us flag

We have migrated website from a vanilla coded PHP to Drupal, and I have also migrated all the users.

The old website has been using the password_hash() function to encrypt the password.

The website has been running for a month now. I'm looking at the user table, and I want to know determine which users has been encrypted using password_hash() or the default Drupal one.

I have this code

$query = \Drupa ...
Score: 1
Karthik avatar
How do I get the comment ID in a template file?
in flag

I want to show the comment title linked to the comment permalink. This is the content of the comment.html.twig file.

 <div{{ content_attributes.addClass('comment__content') }}>
    {% if title %}
      {{ title_prefix }}
      <h3{{ title_attributes }}><a href="#comment-{{comment.id}}">{{ title | render | striptags}}</a></h3>
      {{ title_suffix }}
    {% endif %}
   ...
Score: 0
spacecraft96 avatar
Programmatically add a taxonomy field to a custom content type
ng flag

I'm familiar with adding fields to a custom content type in the yaml files of the module. I'm unable to find an example of how to add taxonomy fields to a content type at programmatically at install.

What does the field.field.node look like?

What does the field.storage.node look like?

Are there special names for the widgets for core.entity_form_display and core.entity_view_display?

Thank you

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.