Latest Drupal related questions

Score: 0
miststudent2011 avatar
How to create a View to display nodes with empty entity referenced fields
fr flag

Can anyone please help me to create a view when entity referenced field is empty. I have a body field where various paragraph fields are referenced. I would like to get list of nodes whose body field is empty.

By default body field is entity referencing to one text paragraph. Even if it is not a required field.

Even thought the para is empty it is not being displayed in the results. If I remove defa ...

Score: 0
How to limit access to the Views pages of the user account?
cn flag

I created Views page with tabs in the users account.

The problem: If I am user 3 and I go to the page of user 56, I have access to the page.

I have searched in the Contextual filters on the Views page and there is no setting to limit this.

How do I limit access to the Views pages of the user account ? The current user must have access to all the pages of his own account, but not to those of other ...

Score: 1
Ajax drupal dialog doesn't respect dialog-option
cn flag

I have:

$options['attributes']['class'][] = 'use-ajax';
$options['attributes']['data-dialog-type'] = 'modal';
$options['attributes']['data-dialog-options'] = json_encode([
  'width' => 375,
]);

return [
  '#markup' => Link::createFromRoute(
    t('My link'),
    $route,
    [],
    $options
  )->toString()
];

which generates a link as expected:

<a href="/node/1" class="use-ajax" data ...
Score: 0
hotwebmatter avatar
Display Fulltext search query string on Search Results page
nr flag

This is probably much simpler than I'm imagining.

Client wants to display the user-entered search query string, with a label (like Search Query or You Searched For), at the top of the search results page.

Currently, the search query is displayed in the form input field (a Views exposed form, in a block) but it has <input size="25">, so many queries are too wide to display.

I've been looking at the f ...

Score: 0
After rendering entity form how can be modified?
br flag

I rendering a custom entity form display with the following code:

$form = $this->entityFormBuilder->getForm($entity, 'array_delimiter');

This is perfect, as it shows what I set on the form display. However when I try to add a new submit callback function (i.e. $form['actions']['submit']['#submit'][] = 'custom_callback';) then this is not being called.
When I try to hide some form items, I lose ...

Score: 4
Allow SVG in Views Rewrite Results
cn flag

I am rewriting the results of a field in a View and depending on the value of a field, I want to display an SVG icon. I can use TWIG to do the conditional logic and that works great, but it won't let me use the SVG tag. There is help text below that says:

You may include Twig or the following allowed HTML tags: <a> <abbr> <acronym> <address> <article> <aside> &lt ...
Score: 0
user888 avatar
Can you not have "computed twig" type in custom composite?
ph flag

I have a field in my custom composite element for qty, unit price, and total. For the field "total", I want this to display the multiply of qty and unit price. However, since there is no computed twig for type I manually added this in YML source:

total:
  '#type': computed_twig
  '#title': Total
  '#template': '{{ (data.qty * data.unit_price) }}'

I still get "- Select type-" for the type of total fiel ...

Score: 0
How to check the external links in the nodes?
cn flag

I use on my Drupal 9 site, affiliate links for different products and services.

These links will appear in my nodes. The problem is that sometimes the provider changes its content, so sometimes the links return to a page not found or a page that does not match the product of the affiliate link.

How to check the external links in the nodes?

Is there a solution to check the validity of affiliate links (r ...

Score: 0
How to Manage Webhook Notifications?
pe flag

I had developed a controller to retrieve data from an API via a webhook. This is the type of data I received with https://webhook.site for testing :

{
  "owner": {
    "id": "100000",
    "userName": "lorem"
  },
  "notes": "",
  "created": {
    "dateTime": "2021-12-14T18:54:36",
    "timeZone": "Europe/Paris"
  },

Here is a preview of the controller :

    class WebhookLoremController extends Contr ...
Score: 0
Display custom taxonomy fields on admin taxonomy listing screen
cn flag

I have a taxonomy vocabulary called "Document Type" that has a custom field attached to it for "Acronym". When an admin is logged in and goes to Structure>Taxonomy>Document Type to display the current list of Document Types in the system, I do not see a way to add the Acronym field to that display. It doesn't look like this is a View like the Content listing screen that can be edited to show addit ...

Score: 1
Reference private file?
in flag

I'm making migration plugin which I'm using in first migration and it is creating private file like this:

if ($final_destination) {
  // Create a file entity.
  $file = File::create([
    'uri' => $final_destination,
    'uid' => $uid,
    'status' => FILE_STATUS_PERMANENT,
  ]);

  $uri = $file->getFileUri();

  $stream = new S3fsStream();
  $stream->writeUriToCache($uri);

  if ($str ...
Score: 0
Glaze avatar
Composer installation missing files from Core
cn flag

I just attempted to update Drupal 9.2.10 to 9.3.0 using composer and received the following error during the database update.

views module
Update sort_identifier
Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "tag" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 5 ...

Score: 1
quantumized avatar
Is there a way to limit the time zones available to the user to select from?
ng flag

We have a Drupal 9 site that has a Smart Date field with Time Zones. However, the time zone selection list is huge. We want to limit it to the four main US times zones. Is this possible?

enter image description here

Score: 0
How can I load a translated version of my custom config?
cn flag

I created a custom configuration form that can be translated into all available languages. My question is how we can get the translated version of the configuration for a specific language on the front page?

When I use

$config = \Drupal::config('my_config.config');

Always return value with the default language. How can load the translated one?

Score: 1
quantumized avatar
Programmatically loading and saving nodes is not updating my field but editing and saving manually does. Why the difference?
ng flag

I have migrated D7 date fields to D9 Smart Date (with recurring). During the migration, I've parsed the legacy repeat rules and populated them into the new D9 Smart Date field.

However, the repeating dates do not show up in Views unless I first manually edit and save the node (without making any changes).

The problem is that I have hundreds of nodes that need to be resaved and none of the progratic  ...

Score: 2
Trudog avatar
How do I access current_page value in views twig template?
ru flag

In views-view.html.twig, I'm trying pager['#views_plugin'].current_page, but don't get any value.

enter image description here

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.