Latest Drupal related questions

Score: 0
Joost avatar
New node of content type always as new book
jp flag

I have two content types: my-book and my-page.

Is it possible to automatically create a new book (using the Book module) when a my-book node is created?

I was looking into using hook_node_presave(), but this doesn't give a node ID to use. Using hook_entity_insert() doesn't permit to change the field values for the newly created node.

Score: 0
BassPlaya avatar
How to use integer fetched from an Entity as an Entity ID?
ma flag

I have a rule component that is supposed to fetch an integer from a property of an entity named "Course" (ECK property). This property is not an entity reference but an integer. I use this property to set the number of Courses "cloned" on the "original course ID" once an entity of Course is "cloned". The cloning works but my component works ONLY IF I use it in my Views Entity VBO as an action. There I s ...

Score: 0
How can I show a flipbook as block in the front page?
cn flag

I've installed the FlipBuilder module that's created via the software and can view the flipbook on its own url, but I want to put a copy of my flipbook on the front page, in its own block or in a panel, but I just can't successfully do this.

I have tried doing it with an iframe, but it says it's refused, perhaps to avoid x-frame issues.

Score: 0
How can I see which modules can be upgraded when upgrading core?
cn flag

Is there a way to get the list of the modules installed on a Drupal 7 site which could be upgraded to Drupal 9 or replaced by modules compatible with Drupal 9?

Score: 0
John Brandenburg avatar
Notice: Undefined index: provider in *_preprocess_block()
eg flag

I am in the process of upgrading a site to Drupal 9. I finally have 9.2.0 in place, but I started seeing a very large number of notices, that all fit the pattern:

Notice: Undefined index: provider in block_theme_suggestions_block() (line 203 of core/modules/block/block.module).

This isn't limited to just the block module, it seems to generate a notice in every implementation of hook_preprocess_bl ...

Score: 1
HotelAlpha744 avatar
How can I render a webform submission on a different page after loading it using a submission id?
ve flag

I'm trying to render the content of the webform submission programmatically onto a different page. I can load the webform submission using the sid, but is it possible to embed the submission in another page similar to the way a webform can be embedded? I can iterate through the submission data and print it out manually, but I want to avoid it since my webform uses various conditionals.

I've tried ...

Score: 0
Marking source or destination fields in a migration as unmigrated
by flag

In Drupal 7, there was a way of marking some source or destination fields as not being migrated. This meant that the field list showed them as omitted, rather than missing a mapping.

From the beer.inc example code in Migrate 7:

    // Unmapped source fields
    $this->addFieldMapping(NULL, 'nickname')
         ->issueGroup(t('DNM'));

    // Unmapped destination fields

    // This is a shortcut ...
Score: 1
Nitro avatar
How many temporary files will be deleted on every cron run?
gb flag

I was just wondering if anyone knew how many files the Drupal cron removes from your tmp/ directory per cron run? Is it limited to 100 at a time? Where can I see this information?

Score: 0
Set local actions - disabled/inactive
cn flag

I am currently searching for a possibility to set an action to "inactive" depending on something. I have found the hook_menu_local_actions_alter(&$local_actions), but do not know how I could use it to set a task to disabled/inactive.

What I have tried for now is:

function my_module_menu_local_actions_alter(&$local_actions) {
  $local_actions['entity.my_module.add_form']['options']['attribute ...
Score: 1
sea26.2 avatar
How to programmatically load a View?
om flag

I have created a View that I want to fetch the output from within a module. On drupal.org, the latest recommendation seems to be

$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load(1)

So, this is my code.

/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$view = \Drupal::entityTypeManager()
  ->getStorage('view')
  ->load($view_id);
$view- ...
Score: 0
How can I add a node template suggestion by node title?
in flag

Twig debugging is suggesting node--4.html.twig as template file for a node whose ID is 4. Since the node ID changes when changing environment, I would need to use a template file whose name is based on the node title.

Is there a straightforward way to achieve this?

I am using Drupal 9.

Score: 0
quantumized avatar
Drush won't run, 'status' shows web directory twice
ng flag

I have a multi-site Drupal 8 install and Drush has stopped working. All Drush commands fail with a "Bootstrap failed" error.

"Drush status" shows the /web dir twice as the root. Manually adding the root (--root:path) results in the same 'Bootstrap Failed" error

Any idea why the web directory would show twice in the root?

SITE@mi3-sr25 [~/public_html/web]# drush status
 PHP binary    : /opt/alt/php73/usr/ ...
Score: 3
How to invalidate the block list cache?
cn flag

I need to invalidate the block list cache each time a new configuration entity is created, this is because I have a derivative block to handle dynamically one block for each of my configuration entities. I tried to invalidate the block list with the following code

Drupal\Core\Cache\Cache::invalidateTags(['block_list']);

But when I go to see available blocks I'm not able to see my new block until I cle ...

Score: 1
calfie avatar
Add relationships that has 3 layers, Parent -> Child1 -> Child2
sa flag

Recently I asked a question that was similar (Parent node needs to display the scheduled date that is referenced in the child node), but requirements have changed and now I'm dealing with the Node A (parent) -> Node B (child) -> Node C (grand-child). Bear with me as I explain this.

Node A is the main parent. It contains an entity reference field that calls Node B. I've successfully create ...

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.