Latest Drupal related questions

Score: 0
byte me avatar
Custom html.html.twig for a display mode
iq flag

While using display suite in drupal 8.6.2 Is it possible to have a custom displaymode-html.html.twig that replaces the default html.html.twig?

So far I have tried enabling the view mode dev hints in themename.yml but it doesn't seem to be showing me anything for html.html.twig

Score: 0
Free Radical avatar
How to alter page title "Create X" to "Add X" for all X?
kz flag

In Drupal 7, there was drupal_get_title()and drupal_set_title(). They're history.

I want to alter the page title "Create X" to "Add X" for all X, and I think hook_preprocess_page_title() in my .theme-file is the right place to do it. (If you disagree, please say so.)

I.e. I want it to be 'Add X' for any 'X' when it originally was 'Create X'. For example: 'Create article' should become 'Add article' ...

Score: -1
Downloading xlsm is disabled for anonymous user: What function is responsible for this access control?
ru flag

We have a D7.8 site with Panopoly 7.x-1.81. No access control modules.

A standard filefield is used for uploads and functions perfectly for the usual set of mime types.

We recently extended the list of allowable extensions in the field definition to include .xlsm

Our xlsm files are code-signed and certified by a Microsoft-approved cert provider.

We can upload the xlsm files no problem, and logged-in users ...

Score: 0
Specify the theme when creating content / importing content via Feeds
cn flag

I want to force all content to be created using my primary site theme. I want to do this because I am using a renderer in MYMODULE_node_presave() like this:

function MYMODULE_node_presave(NodeInterface $node) {
  $renderer = \Drupal::service('renderer');

  $content_type = $node->getType();
  if ($content_type == 'page') {
    $viewmode_render = $node->get('field_text_main_to_render')
      ->vi ...
Score: 2
Kevin avatar
Add ThirdPartySettings to individual paragraphs of a certain bundle?
in flag

I want to add configuration settings to Paragraph entities in a specific bundle in Drupal 8. Theres potentially a lot of options and the need to change/update them over time, so I figure the best way is through ThirdPartySettings and not adding more fields to it. I am going to use these values to influence certain aspects of the render and for search queries.

I can see where you can add settings  ...

Score: 0
Add rows to form tableselect with AJAX
na flag

I would like to:

1.) Add rows to a tableselect form element when a user clicks on a button.

2.) See which rows are selected when a user clicks on another button.

Part one is complete (I've only included relevant code):

public function buildForm(array $form, FormStateInterface $form_state) {

  //Tableselect
  $header = [
    'first_name' => $this->t('First Name'),
  ]

  $form['results'] = [ ...
Score: -2
jhnc avatar
how was text format deleted?
cn flag

I migrated a drupal 6 site to drupal 8. It still needs the php module. I have a text format with the "PHP evaluator" filter enabled.

Overnight, this text format disappeared.

I was asleep. Only the adminstrator role has "administer text formats and filters" permission but I have no reason to believe an administrator deleted it manually.

How else could this have got removed?


I recovered by:

  • backed up t ...
Score: 0
Interlated avatar
What is the token for the file download link of a media entity?
km flag

Using the linked_field module and the [paragraph:field_pbpresentation_file:entity:url] token, I get the edit link for the media entity, not the link to download the file itself.

What token should I use for the download link?

Score: 0
Delford Chaffin avatar
Is there a way to specify which content should be shown from the the "Entity View (Content)" block?
gg flag

As part of CTools, there is the "Entity View (Content)" block that can be used in Layout Builder, but that only shows the current content. Is there a way to specify another piece of content?

For example, on my front page, I would like to place a block that renders the teaser view for another content without having to build a view or add a reference field or something.

Score: 0
Is there a way to strip field set and description from [submission:values] in the emails tab?
dj flag

I have a very long form. I would like to use the simple [submission:values] token in the email, but I'm hoping there is a way to add something that will leave out all the extraneous information like field set labels and descriptions.

Score: 2
Ramalingam Perumal avatar
How to get content url in views-view-unformatted block template
mx flag

In Drupal 8, I created template for solr search view views-view-unformatted--solr_search_content--block.html.twig

I am trying to print the content link by {{ row.content['#view'].style_plugin.render_tokens[ loop.index0 ]['{{ title }}'] }}

But displayed title with link. I need link only, Any Idea!

{% for row in rows %}
<div class="row block p-5">      
    <div class="views-row">
      {{- row ...
Score: 1
RepublicOfDavid avatar
Programmatically verify a taxonomy term has been added to a node
fr flag

I'm currently checking the node type and status, using the following code.

$query = \Drupal::entityQuery('node')
  ->condition('status', 1)
  ->condition('type', 'content_page')
  ->execute();

foreach ($query as $nid) {
  // …
}

I need to know whether a taxonomy term has been added to a node. I don't need to know the name or ID of that term, which is a taxonomy term from the Group Requ ...

Score: 0
How to fix an empty editing window while content is shown in frontend
cn flag

There are a lot of empty editing windows while content is shown in frontend. Only the body field in editing mode is empty. The text is in the database. It has nothing to do with the content type. Some nodes are complete in frontend and editing mode, some don't.

I copied the content from frontend into the edited window and saved it. There is no double content in frontend. After saving and reeditin ...

Score: 0
hook_mail_alter() doesn't remove the Return-Path, Sender, and Reply-To headers
us flag

I want to remove the Return-Path, Sender, and Reply-To headers from the sent emails. I am trying to achieve this using the following code, but the headers aren't removed from the email.

function mymodule_mail_alter(&$message) {
  unset($message['headers']['Return-Path']);
  unset($message['headers']['Sender']);
  unset($message['headers']['Reply-To']);
}

What am I doing wrong?

Score: -1
View with multiple blocks, how to specify which is shown?
ph flag

I have a view that is placed as a block below my main content. Within that view I have block "displays". each having a different contextual filter for their id from url.

The problem is when the view is displayed, it only shows one of the Displays, how do i specify which is shown ?

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.