Latest Drupal related questions

Score: -2
How do I show a block with a unique QR for each node?
th flag

There is requirement where I need to Place a Block on node where each block will be having the Unique QR code.

I created an hard-coded QR code block with the following code.

public function build() {
  $path = '';
  $directory = "public://Images/QrCodes/";
  \Drupal::service('file_system')->prepareDirectory($directory, \Drupal\Core\File\FileSystemInterface::CREATE_DIRECTORY);
  $qrName = 'myQrcode';
 ...
Score: 0
I can't debug a functional test for a custom module
id flag

I am trying to debug the functional tests for my custom module.
When I run the debugger, it doesn't hit the breakpoint I've set on the first line of the test method. However, when I debug a functional test from the Node module, it works.

Score: 0
MacSim avatar
How to change the label of an image's title field in a paragraph
um flag

In a paragraph I have an image field for which the title field is enabled and required. I need to alter the label of this title field to replace "Title" by "Caption"

I tried to use the hook_field_widget_single_element_WIDGET_TYPE_form_alter() to achieve this but all I see related to this title is

$element['subform']['image']['widget'][0]['#title_field'] = (bool) 1
$element['subform']['image']['widg ...
Score: 0
vyshnavi avatar
How can I use the custom image as thumbnail for Youtube videos?
eg flag

i want to use custom image as thumbnail for remote video (youtube) in my paragraphs , I create one field called custom image under remote video and used the below code.

if ($entity->bundle() === 'remote_video' && isset($entity->get('field_custom_image')->target_id)) {
  $entity->get('thumbnail')->target_id = $entity->get('field_optional_custom_image')->target_id;
}

The thumb ...

Score: 1
liquidcms avatar
What is the correct way to set language used by a modal form?
us flag

I have a button linked through a controller to open a custom form in a modal:

The controller callback is:

  /**
   * Callback for opening the modal form.
   */
  public function openShareLinkModalForm() {
    $response = new AjaxResponse();

    // Get the modal form using the form builder.
    $modal_form = $this->formBuilder->getForm('Drupal\ssc_wsl\Form\ShareLinkModalForm');

    // Add an AJ ...
Score: 0
timwhelan avatar
Send mail with Data Selector
us flag

In Drupal 9 Rules 8.x alpha 7 - I have a rule working. However, I am trying to send an email to the user of the account that is changed.

I am trying to figure out the data selector to make this happen. I have tried token for an email: {{ profile.uid.entity.mail }} I have tried profile.uid.entity.mail.value as a data selector and many other things I am finding online.

I have Entity is of Bundle an ...

Score: 0
abelass avatar
Open a paragraph programmatically
nl flag

I have a paragraph contact nested inside another paragraph occurrence.

In the widget settings the paragraph contact is defined to be collapsed by default (edit_mode = closed).

I want the contact paragraph only to be open when creating the content and only on the first occurrence.

How can this be achieved?

Thanks in advance.

Score: 0
Upgrading to 8.8.0 Receive PluginNotFoundException: The "group" entity type does not exist
hk flag

I'm updating from 8.7.4 to 8.8.0. After updating core/modules and running "/update.php", I receive the follow error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "group" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of core\lib\Drupal\Core\Entity\EntityTypeManager.php).

Any ideas? I am using the Group module, version 1.0-rc4, if t ...

Score: 0
Mark Edwards avatar
Login fails: returns to anonymous user home page with no message
pl flag

I am testing upgrade to Drupal 9. I upgraded core and logged in and fixed a few issues with module deprecated code and then was presented with a Twig issue where replace syntax had changed. I changed a few views that had embedded twig syntax to rewrite some results and logged out.

On trying to log back in to continue with views amendments I found that the admin login (or any other user) would not ...

Score: 0
Frédéric Hébert avatar
unapplied patch reinstall the drupal core
us flag

I've upgraded a site from d8 to d9. And I'm rewarded with this error :

- Applying patches for drupal/core
https://www.drupal.org/files/issues/2021-03-15/claro_theme_is_incompatible_with_the_themable_forms_module-3203745-1.patch (Claro theme is incompatible with the Themable Forms module)
 Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2021-03- ...
Score: 1
Chris avatar
Queue API - Run a function after a queue has finished?
be flag

I have created a custom queue that imports entities from an external api. During each queue item process I want to save the id of the created/updated entity, and at the end of the queue I want to use those ids to determine which entities should no longer exist and be deleted.

Is there a way to run a function at the end of a queue? And if so, how can I store the ids that I need and pass it to this ...

Score: 0
programmatically get child nodes referencing parent by entity reference uuid, using loadByProperties & entityTypeManager or other way without views
cn flag

I tried this answer:

https://drupal.stackexchange.com/a/298084/1082

But I can't seem to use

'field_scientists' => $entity_reference_uuid

where, in my case, field_scientists is a field of type Entity Reference UUID - which is a field type provided by https://www.drupal.org/project/entity_reference_uuid module

What happens for me is that I get nothing back, my results array from that example is  ...

Score: 1
May  avatar
graphql mutations, how to create link field?
zw flag

I am following this guide. https://drupal-graphql.gitbook.io/graphql/mutations/mutations

I have created a module and with a plain text field I can run

mutation {
  createArticle(data: { title: "https://google.com" }) {
    ... on Article {
      id
      title
    }
  }
}

And it creates an article with title https://google.com.

Now I am trying to add a link field. I have updated the module to write to a  ...

Score: 0
Charles Belov avatar
Filter a view on whether the page has a menu link
cn flag

I'd like to make a view listing all pages that do not have "Provide a Menu Link" checked so that I can review them for pages that would appropriately have a menu link to a parent page.

I can't seem to find any field in the filters which would cover this.

I saw a thread get menu link Page Settings from View configuration but the code in the solution seems specific to Drupal 8 and I need to solve th ...

Score: 1
Compress file with ArchiveInterface without file paths
us flag

I'm trying to create an archive of log files to be downloadable in a form making a custom module in Drupal 9. In the form, the user can change the format of the archive, as per image: Screen of the log form

Here below my code:

private function download($form, $form_state) {
  $format = $form_state->getValue('format');
  $folder = $form_state->getValue('folders');

  $date = new DateTime();
  $date = $date->format("y ...

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.