Latest Drupal related questions

Score: 0
0711master avatar
How can I change the title of the node/add page of a specific content type?
cn flag

I want to change the title of the node/add page of a specific content type. Twig debug only shows me file names that would also change the titles of other content types. There was a module for this in D7, but unfortunately it was not ported to D8.

Score: 0
How to create a configuration export such that it installs two modules, one of which has a dependency on the other?
cn flag

I've written a custom module that uses jwt.transcoder service from the jwt module. In turn, it provides another service:

$ cat mymodule.services.yml
services:
  mymodule.jwt:
    class: Drupal\mymodule\Services\Jwt
    arguments: [ '@jwt.transcoder', '@event_dispatcher' ]

Everything went smoothly during development. However, neither the jwt module, nor my new custom module, were installed on our  ...

Score: 1
Create a PDF from a node after the node is deleted
uy flag
Nyn

I want to create a PDF from a node when the node is deleted.

I am rendering the node using the following code.

$entity = \Drupal::entityTypeManager();
$view_builder = $entity->getViewBuilder('node');
$build = $view_builder->view($node);
$output = \Drupal::service('renderer')->render($build);

The output comes from node.html.twig, whereas the actual template file should be node--content-ty ...

Score: -1
mauzilla avatar
View plain text field causing rendering issues for translations
cn flag

Our news section has a plain text field for article header. At the time of development this seemed like a good idea, however, having gone live, some languages like French has special characters which is now causing rendering issues as example:

enter image description here

Is rendered as:

enter image description here

I understand why this is happening as text fields are "escaped" for security reasons. The problem here is one of hindsight:

  1. We cannot delete the  ...
Score: 0
How can I customize an administrative view template from a custom module?
us flag

I created a view with a page display whose path is /admin/content/noun, and whose format is table. I'd like to override the table template with views-view-table--the-view-name--the-display-id.html.twig. The view's path means the view is displayed in the admin theme. Where do I put the template?

Creating a Claro's sub-theme doesn't work. Customizing web/core/themes/claro/templates/classy/views/view ...

Score: 0
Cannot set path alias to "/"
cn flag

I have a weird use case where I need to specifically set the path alias of my home page to "/".

I am creating a Gatsby site and the pages are auto generated based completely off of the Drupal path alias. So If I have a path alias of "/about", the /about page will get generated in Gatsby.

The problem is that for my home page, I cannot set the path alias to just "/" in Drupal. If I try doing that on t ...

Score: 1
Post data to term field through JSONAPI
de flag

Trying to create node via JsonAPi. It contains a term field and text field. Managed to post text field without any issues but struggle to post values to term field. Anyone guide me to post values to term fields. format shared below

"data": {
    "type": "node--verification",
    "attributes": {
        "title": "My custom title"

       }
    "relationships": {
        "field_executing_agency": {
  ...
Score: 0
Ernesto Alfredo avatar
Creating link option in form and modifying it's url in form alter hook
us flag

I'm searching to modify a node add form, so far i added a personal field "link" to display as a button to add another node type if the user wants to, that link has this code in hook_form_alter, im catching a value from another select earlier and passing that value to my route::

    $selected_advertiser = isset($form_state->getUserInput()['field_advertiser'])? $form_state->getUserInput()['field_adver ...
Score: 0
mauzilla avatar
Preprocessor not returning news based on the correct created date
cn flag

I am returning news to my homepage in a carousel. I am using the below query to return the latest 9 articles based on the "created" date. The client however wants to back date some articles (so admin > content > edit node > authored by and change the created date). This however does not seem to work as keeps returning the articles in the actual date order they were created, even if the date was ...

Score: -2
Dadaisme avatar
Error when installing Rules with composer
in flag

I've tried to install the latest Rules via composer on drupal 9.3.9. I am new to composer.

I uses "composer require 'drupal/rules:^3.0@alpha'" and got a similar error that on issue https://www.drupal.org/project/rules/issues/3240025

So, I have tried the dev version ("composer require 'drupal/rules:3.x-dev'") and received another error:

Problem 1 - drupal/rules dev-3.x requires drupal/typed_data ^1.0 -&gt ...

Score: 0
No link template Error on saving node having field referencing a particular taxonomy vocabulary
id flag

I am getting the following error on saving a node.

Drupal\Core\Entity\Exception\UndefinedLinkTemplateException: No link template '' found for the 'taxonomy_term' entity type in Drupal\Core\Entity\EntityBase->toUrl() (line 196 of /opt/app-root/src/web/core/lib/Drupal/Core/Entity/EntityBase.php). 

I realised that this happens to any content type having a field referencing a particular taxonomy vocabu ...

Score: 3
May  avatar
How can I replace a string in a text?
zw flag

With {{ content.field_myfield.0 }}, I get a text. When I use {{ content.field_myfield.0|replace({"foo" : "bar"}) }}, nothing is rendered and no errors are reported.

I also tried replacing content.field_myfield.0 with content.field_myfield.value or `content.field_myfield.0.value, but I still get an empty string.

How can I replace a string?

Thanks

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.