Latest Drupal related questions

Score: 0
Jude Hungerford avatar
Creating links in TableSelect rows
cn flag

I've created a module which defines a Form, but when I try to add a column of links, it is empty when I set the '#type' to 'link'. I am testing this on Drupal 9.3.x.

On the surface, this is the same as Add a link to a tableselect row, but the answer posted there does not contain the full working code, and I'm fairly sure the solution in my context is going to differ from the one posted there.

This is  ...

Score: 0
Brittany avatar
Title field returning ' where apostrophe should be?
ph flag

I have a series of fields on a View. For some reason, any node title field with an apostrophe in it is being returned to my endpoint as Jen's Cupcake Store instead of Jenn's Cupcake Store.

Any idea how I can fix this? Been at it for a few days now and I can't seem to find a single solid solution. Help is appreciated!

Score: 1
pglatz avatar
Can paragraph fields in a node be sorted?
in flag

I have a node content type with a paragraph field with multiple values. The paragraph has a date and a text field. When I display the node, I'd like to sort the paragraph values by date. I've tried doing this in twig with the sort filter to no avail. Can this be done somehow, maybe with preprocessing the field?

Score: -4
pglatz avatar
Installing console with php 8
in flag

I'm trying to install Drupal Console into a Drupal 9 installation, and get a php compatibility error:

% composer require drupal/console \
--prefer-dist \
--optimize-autoloader \
--sort-packages \
--no-update

...
drupal/console[v1.9.0, ..., 1.9.4] require php ^5.5.9 || ^7.0 -> your php version (8.0.8) does not satisfy that requirement.

Is Console compatible with Drupal 8? Is there a workaround?

Score: 0
Custom Simple Action after updating a node
cn flag

I am trying to create a simple way to execute certain actions on the database every time when I update a node.

I have been looking at Drupal's Action module, however I can't find any good manuals explaining how to use it. The ECA module works as a mechanism to launch my Action but I can't execute my Action and I don't know how to proceed.

I am currently creating my own module that will contain my a ...

Score: 0
pmagunia avatar
Changing the Moderation State Control Box input to a textarea
au flag

I wanted to change the moderation state control box input to a textarea like the image below shows. Currently the input only supports 128 characters but I believe log messages can hold much more in the database.

Moderation control input

Score: 0
How to solve "Mismatched entity and/or field definitions", specifically, "The URL alias field needs to be installed"?
cn flag

After migrating from 7.89 to 9.3.12 this warning appears:

ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. File The URL alias field needs to be installed.

How do I solve this?

Score: 0
rd89 avatar
How to access node entity reference on comment save via rules?
tk flag

I have a content type with a user reference field on it, the users are populated here by a view.

When a user saves a comment, I want to access that field and send an email to user in the entity reference field.

Score: 0
liquidcms avatar
How to pass Block ID to a view?
us flag

I have a Custom Block type called HomeBlocks. This bundle has a paragraphs field which allows multiple paragraphs.

I then place (using Layout Builder) an instance of this block type on my home page (a node type called Landing Page). In the layout of the block type I have a View which lists some of the paragraphs added to that specific block. The view lists my paragraphs but lists all the paragrap ...

Score: 0
View data export with custom table doesn't work if user is not admin
vn flag

I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it.
For the moment, I've defined a view consuming the custom table data thanks to the Views Custom Table module and it works fine. I've installed the Views Data Export module and configured a display to export data as CSV. This display is attached to the base display.
The CSV button is show on the ...

Score: 1
Joost avatar
Search is very slow for certain roles
jp flag

I'm a bit lost here. I have a strange problem and don't know where to begin. I use the core search function on a website I build. When I am logged in as administrator this search function is working and is very fast. When I log in as one of the users (with other role and permissions) the search function is very slow and sometimes even ending up in a 504 page.

I can't think of a good starting poin ...

Score: 1
Kevin avatar
Custom theme function for a Field
in flag

I want to change a theme hook for one field from a custom FieldFormatter. It's #theme callback is 'field' but I want to give the user the option to toggle a setting that changes this to 'field_raw', which then uses a Twig template with no markup. I can't figure out the theme hook.

Twig template:

{%- for item in items %}{{ item.content }}{% endfor -%}

Module hook:

function mymodule_theme($existing, $ ...
Score: 0
Bouhouch Khalid avatar
Web form Custom element
jp flag

I created a custom webform element, It works perfectly, but when I add a table form element, It is not showing enter image description here

My Code :

    <?php

namespace Drupal\webform_mapper\Plugin\WebformElement;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElementBase;
use Drupal\we ...
Score: -2
How to create a custom layout with for a view, I have tried to print the fields but nothing works I created the template but cant display rows
ar flag

I have a view in drupal 7 but I cant show up the rows, I created a template for the row-style-output but nothing happen.

<?php

/**
 * @file
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, i ...
Score: 0
Andrew Morris avatar
Entity agnostic way of retrieving title
mw flag

Is there a way of the Title/Label/Name of an unknown entity type via 1 method?

At the moment if it's a node, I have to use $entity->getTitle(), for a user it's $entity->getAccountName(), for a taxonomy term it'd be $entity->getName()

In my head they all feel like the same piece of information, is there a way of retrieving it without having to write out possibilities for each type of entity?

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.