Latest Drupal related questions

Score: 0
Frank6 avatar
Access block content data from blocks inserted in the layout builder via Restful API
cn flag

I am looking for a way to access the block content data from blocks that were place in the layout builder. I am looking for a way to do it using the Restful WebService module and not JSON-API.

I know it is possible to access the block_content using JSON-API like so : http://contenta.ddev.site/api/block_content/card/3a9e181a-659b-4adf-ad1d-f854674147cc

but I am looking to use the Restful module an ...

Score: 0
chalo avatar
Programmatically reset the selected elements of an entity browser widget
de flag

What I am trying to do, when the value of a field changes, reset and show the original selection widget.

For example:

1.- The first time the browser widget is displayed.

1 step

2.- After having added an element to the browser, it would look like this.

2 second step

3.- If I check the checkbox to reset, it should go back to the original state

3 reset step

What would be the path to take to achieve this behavior?

Score: 1
How to create a view that shows content related to each other through a taxonomy vocabulary?
uz flag

I don't really know how to put my problem into words, so I am trying to explain it with an example:

I have a Taxonomy Vocabulary X.
I have Content Type A with Field a, which references Vocabulary X and allows to enter unlimited terms.
I have Content Type B with Field b, which references Vocabulary X and allows to enter unlimited terms.

I want to create View C with a Block Display, which is then placed ...

Score: 4
Thomas Crawford avatar
Enable layout builder on custom controller page
al flag

I created a simple page in a controller class:

  public function taxonomyPage($term) {
    return [
      '#type' => 'markup',
      '#markup' => $this->t('<p>Need to render layout builder here.</p>'),
    ];
  }

Routing:

knmt_taxonomy.detail:
  path: '/tags/{term}'
  defaults:
    _controller: '\Drupal\knmt_taxonomy\Controller\TaxonomyController::taxonomyPage'
  requirements ...
Score: 0
Raja Chakraborty avatar
How can I set a default value to show for a taxonomy term name in its edit form?
in flag

I have a site where I have a taxonomy term. I want to set a default value to the term name and display it when the form loads. In hook_form_alter(), I tried to set the default value to Check term name in the form. The form loads with this value, but even after changing the value in the text field, the form gets submitted with Check term name.

This is the code I am using to set the default value.



										
Score: 0
miststudent2011 avatar
How to create a vertical table
fr flag

Can anyone please help me to render theme_table data in vertical format instead of horizontal format ? Currently horizontal table is overflowing the page and breaking breaking points.

My current code :

    $build['table'] = [
      '#type' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => $this->t('No content has been found.'),
    ];

    return $build;
 ...
Score: 2
sonfd avatar
How can I execute a batch process in hook_install()?
in flag

When my module is installed, I need to execute a batch process, loading hundreds of entities and doing stuff with them.

This is trivial with hook_post_update_NAME() and its $sandbox variable. How can I achieve the same sort of thing via hook_install()?

Score: 0
Ckeditor does not show the latest image
kr flag

I have a media item that is displayed in the body field with Ckeditor with the following markup.

<drupal-media data-align="center" data-entity-type="media" data-entity-uuid="8037391d-5a84-4ced-a88d-587fccc013bf"></drupal-media>

I edited the media item and replaced the image, but the node edit form is still showing the old image, in the preview. The node page shows the correct image, though. ...

Score: 0
Append info to original filename when uploading file in webform (filename token)
br flag

I'm sure I am missing something really obvious. Drupal 7 + Webform + File (Field) paths.

I am uploading files (jpg, pdf, xls) in a webform and need to append the node NID to the original filename. But I can't seem to find a token for the name of the uploaded file.

Example:

  • node/123
  • Upload file abc.pdf.
  • rename it to '123-abc.pdf'

Tried these but they don't fetch the filename: [node:nid]-[file:origin ...

Score: 2
Joseph avatar
How do I properly define a library so that JS will execute after a certain condition is met?
cn flag

I'm creating a custom module to execute some JS AFTER the cache is cleared. Here is the structure of the module:

Module -> flush.info.yml

name: Flush
type: module
description: A very important module.
package: Custom
version: 1.0
core_version_requirement: ^8 || ^9

Module -> flush.libraries.yml

flush:
  version: 1.x
  js:
    js/flush.js: {}
  dependencies:
    - core/jquery
    - core/drupalSe ...

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.