Latest Drupal related questions

Score: 0
Webform created date
hu flag

Is it possible to see the date a webform was created?

We use webforms extensively and sometimes they have very similar names, we want to be able to see when a webform was created to be able to determine which is the correct one.

This doesn't appear to be in the webform object nor in any db tables.

Score: 0
Mauricio avatar
How can i render a file using a formatter programmatically in a controller?
lb flag

I'm trying to create a controller to render a swagger documentation using the module swagger_ui_formatter that provide a formatter to the file field that render swagger files (yml, yaml, json) using javascript libraries to show the documentation like swagger website do. Then i copy my yml file in my module directory and in my controller i can load this file.

  public function buildApiDocumentation()  ...
Score: -1
jfc avatar
How do I suggest to use a template name like "node--[content-type-name]"?
us flag
jfc

I would like to name my node template after the content type title, but my suggestions only show the node number.

FILE NAME SUGGESTIONS:

  • html--node--1.html.twig
  • html--node--%.html.twig
  • html--node.html.twig
  • x html.html.twig

I don't want to name it node--1 just in case the node ID changes in the future. I'd like to name it node--content-type-name.

Is there a setting to enable this?

Score: -3
Steffen  avatar
How to get table names from external DB in non public schema
cn flag

I am writing a configuration entity modul in drupal 9. I want to list all tables, from an external database (postgis) in the schema called gi. The switch between the databases is no problem. I'm searching for a way, to only get the name of the table called gruenzuege to put this in a markup form.

//the form where to save the table

 $form['tables'] = [
      '#type' => 'fieldset',
      '#title' =&g ...
Score: 0
miststudent2011 avatar
How do I migrate body content with [embed]*[/embed] tags?
fr flag

Currently I am working on migrating a Drupal 7 site to Drupal 9. The nodes in the site has nodes with content similar to the following one.

<h3><strong>WHAT WILL YOUR NEXT MEAL BE?</strong></h3>
<p>[embed]https://www.youtube.com/watch?v=Np28O3Y_P2o[/embed]</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry galley of type and Lor ...
Score: 1
C0c0b33f avatar
Files migration from local dev site
kh flag

I'm migrating from Drupal 7 to Drupal 9 and am having an issue with my source files getting found with the upgrade_d7_file migration. My public files directory for my source site is not 'sites/default/files'. It's a multisite instance and it's public file directory is 'sites/example.com/files'. I have exported the configuration generated with migrate-upgrade --configure-only and can change the so ...

Score: -2
Views Reference Field shows nodes of all groups
id flag

On my website users can create groups. All groups have two content types:

  • Book
  • Chapter (is always a child of content type Book)

Only administrators are allowed to create new nodes. An administrator could be a member of two groups.

In the content type Book a Views Reference Field is created, which all nodes from the content type Chapter shows.

The problem I'm facing: If an administrator creates a new Boo ...

Score: 1
JustinChev avatar
Auto add content to specific entity queue dependant on chosen taxonomy term
br flag

I have a People content type, which has an Expertise field which is a taxonomy term reference field.

There will then be an EntityQueue set up for each Expertise term.

What I'd like to do is automatically add all People profiles to the end of their relevant Expertise EntityQueue. For example, Management EntityQueue will auto populate with all people who are managers, and you will be able to reorder them b ...

Score: 0
Multiple sites/default folders
cn flag

I have a Drupal 8 website on Docker containers. Drupal sites folders contains, besides the default folder, two folders, the settings.php file, and configuration.

The goal is to have different configuration inside each folder (inside each settings.php) and connected to same or different database.

Because client wants only one instance of Drupal (a single set of containers), how can I manage the website ...

Score: 1
Lokesh1024 avatar
How do I implement a JSON/JSONB data type field to display data as separate columuns?
vn flag

I have a custom table that consists of 2 columns, id and data. I want to create a view table with filter. The table columns should be id, product, and item. product and item are from the data column which contains JSON data (for example {"product": "a", "item": "b"}).

Is it possible to create this type of view?

As per my knowledge, it's not possible to create because a view works with columns that exist  ...

Score: -2
What are the causes of the malfunction (The provided host name is not valid for this server) and how to fix it?
cn flag

My site stopped suddenly, with an error message

The provided host name is not valid for this server.

And even though I removed

$settings['trusted_host_patterns']

Completely from the settings file and cleared the cache via Drush

drush cache-rebuild

also, i tried use this settings:

$settings['trusted_host_patterns'] = [ '.*' ]; and $settings['trusted_host_patterns'] = [];

but, the site still sh ...

Score: 3
Is there an event related to the creation of a session cookie for anonymous users?
cn flag

I need to set an additional cookie whenever an anonymous user received a session cookie. This happens when selecting a facet in Search API for example. The specific use case is that I need an extra cookie set specifically for a third-party integration (GTranslate). hook_user_login doesn't meet the use case because the user isn't actually logged in but they do receive a session cookie upon selecting a fa ...

Score: 0
Nasser Karimi avatar
How set violation to postal_code field on Address Fields
ye flag

Address field is collection of other fields that one of them is postal_code. I wrote a custom validation constraint. It is applied and working. but the error message is showing for all fields of Address field, I just want it for Postal_code, how that is possible?

This is my ZipCodeValueValidator class

<?php

namespace Drupal\zip_code_lookup\Plugin\Validation\Constraint;

use Symfony\Componen ...
Score: 2
Joining two text fields in a Computed Text field
in flag

I have two fields whose type is List (text). In the allowed values list, i want to join them. I used the following code.

$value = $entity->field_a->value . $entity->field_b->value;
$value = $fields['field_a'][0]['value'] . $fields['field_b'][0]['value'];

I can get the result fine, but the value returns the keys only. How can I get the labels?

image of field content i have the key in english, but the label in arabic

Score: -1
Is it possible to check with Twig the role the current user has?
cn flag

Is it possible to check with Twig the Group role the current user has, to use it as in the following code?

{% if is_member == true %}
  {# … #}
{% endif %}

I tried with $group_memberships = \Drupal::service('group.membership_loader').loadByUser($account); in the .theme file, but it doesn't work.

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.