Latest Drupal related questions

Score: 0
Any Context PHP Condition Plugin going forward
au flag

The context module relies on the now deprecated php filter module for the PHP conditions. Basically, if you want to write a context with condition based on PHP, you must install php filter.

Since php filter is now deprecated, is there any module replacing that?

Score: 0
Kevin avatar
Change breadcrumb title based on a node field?
in flag

I am using the Menu Breadcrumb module to automatically generate a breadcrumb based on the menu placement of the currently viewed node. I want to change some of the titles in the breadcrumb chain based on a field on the node. If it exists and is not empty, the breadcrumb should use that instead of the node title.

Whats the most effective way to do this without extending Menu Breadcrumb to make a s ...

Score: 2
Anton avatar
How to remove user role temporarily?
de flag

I need to disable the "administrator" role from user accounts who log into my website from outside my network. For security, I only want users who have this role to be able to use it when they are on my network (determined by some custom PHP code I have).

I know I can remove a role from a user permanently using the appropriate entity methods like this:

<?php
use Drupal\user\Entity\User;

$user = Us ...
Score: 0
mauzilla avatar
View to return multi-nested criteria
cn flag

My website has articles. Each article has a field 'region restricted' (default is OFF). I want to on my view display all articles which is not restricted but also show articles that are restricted and has a translation in the active language the website is currently set to.

For example, if the site is currently set to french, show me all articles regardless of translation where the region restric ...

Score: 0
C.A. Vuyk avatar
Devel Generate keeps generating files after uninstalling it
cn flag

Some time ago I removed Devel from my site because it is in production now. However, when I look at the Content list I still see files being generated, like generateImage_J4d7CV.png and nq3cv2oMx9.txt

I tried to reinstall and deinstall Devel from scratch, that didn't solve it. A Google search on the issue rendered no solution either.

What could I do to prevent further generation of useless files?

Score: 0
mauzilla avatar
EntityQuery to return translated version where available
cn flag

I am returning a subset of data using a preprocessor and entityQuery:

$query = \Drupal::entityQuery('node');
    $query->accessCheck(FALSE)
        ->condition('type', 'news')
        ->sort('changed', 'DESC')
        ->range(0, 9);

$nids = $query->execute();
$entities = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids);

Some of these articles may have transla ...

Score: 1
How to add complete value programmatically with Smart Date module?
sa flag

Iam using module Smart Date on Drupal 9.

And required programmatically add value to node in field with recurring rule (like Repeats every 1 year on xxxx-xx-xx). Technically, for this action also creating record in Rule table... But I understand, how this do... It seems like the smartdate module itself should make an entry in this additional table.

I used like this operation:

// Create new node:
$n ...
Score: 0
Taher hani avatar
save file in file_usage of custom field
uy flag

I have created a custom field for advice it has four subfields : title, body, url, image.

Everything works perfectly except the image is deleted after a certain period of time because it was not added to the file_usage table. How do I add it to the table?

The code for the custom field:

    <?php

namespace Drupal\industry\Plugin\Field\FieldType;

use Drupal\Component\Render\PlainTextOutput;
use Drupal ...
Score: 0
Is there a way to redirect any 404 to the homepage?
my flag

I understand that Drupal doesn't have a core module to handle redirects and that's normally done by the Redirect module, or from the webserver.

But if I want to redirect any 404 to the homepage, due to say, a very content-varied site in which it's unlikely to find articles on the same topic, can this be done with Drupal core without editing webserver file?

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.