Latest Drupal related questions

Score: 0
Jewel Chakraborty avatar
How can we restrict the access of files in public folder from anonymous users?
us flag

In my project, I am using headless Drupal with .Net on the front end.

I have to use encrypted file system for the project requirements. I am encrypting the files and then decrypting using oauth token and storing them in public folder so that .Net application can get the file as API response. But the problem starts here. As these files are in public folder, if a user logs in to the site and then c ...

Score: 0
Interlated avatar
How do I load the address from CiviCRM into a commerce billing profile?
km flag

I have a commerce store linked with CiviCRM. I'd like that customers only enter their address once, in the CiviCRM contact profile.

How do I load the profile to copy to a Commerce billing profile?

I have installed civicrm_entity.

These are the ways I can think of doing it:

  1. Load the CiviCRM session.

How do I get my module to load CiviCRM classes? I see that civicrm_entity loads CRM_Core_BAO_UFMatch ...

Score: 1
hotwebmatter avatar
ConstraintValidator fails to validate constraint on Taxonomy Term reference field
nr flag

Client has a simple and consistent hierarchical taxonomy.

Cities at the top level and Schools at the second level.

.
├── City1
│   ├── School1
│   ├── School2
│   └── School5
└── City2
    ├── School3
    └── School4

The User account entity bundle contains an Entity Reference field to the School taxonomy terms.

I am trying to enforce a constra ...

Score: 0
Controlling dropdown field visibility using #states API for dependent dropdown
cn flag

I have the following setup.

dropdown_one

[
    '#type' => 'select',
    '#title' => $this->t('Dropdown one'),
    '#options' => $dropdownOneOptions,
    '#empty_option' => '---',
    '#weight' => 1,
    '#ajax' => [
      'event' => 'change',
      'callback' => [$this, 'getDropdownTwoOptions'],
      'wrapper' => 'dropdown-two',
      'progress' => [
        'type' =& ...
Score: 0
Add more fields in rss feed views
cn flag

I would create an Views with feed RSS and want to include more fields in this xml page ? any idea ?

I used the content mode with mode tease but it's include the HTML tags & attributes !

<item>
  <title>Lorem ipsum</title>
  <link>http://localhost/node/1</link>
  <description>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididu ...
Score: 0
Josh avatar
How to make Twig variable provided by module available to a twig template of an other module?
kz flag

I am a newbie when it comes to combining drupal's API functions with a twig template.

I've created a node filed called font awesome icon The Twig variables of this field are in

fontawesomeicon.html.twig:

 * tag: the HTML tag being used to create the icon. 
 * icon: the name of the icon being used for templating.
 * style: the Font Awesome style for the icon.
 * settings: the additional Font Awesome style ...
Score: 0
Edward Peters avatar
Why doesn't the Status Report page show any information?
in flag

I've just done an upgrade of my site from Drupal 8.9.16 to Drupal 9.2.6. Everything looks fine but when I go to /admin/reports/status there is no information as per the screenshot. I've never come across this before, can anyone help?

I cleared the cache multiple times, ran Cron, without any effect.

screenshot

Score: -2
Can't import webform settings after creating / testing a form
in flag

On server I already have site setup with webform module installed. If I i.e. create and test some webform and after that try to import webform configuration with drush cim I get error:

"There are entities of the type Webform submission and Webform Kontakt form These entities must be deleted before importing".

That issue is also reported here: https://www.drupal.org/project/webform/issues/3076341 ...

Score: 0
Stef Van Looveren avatar
Where to define custom entity caching rules of detail pages
cn flag

When you have a larger project you probably have both internal page cache as internal dynamic page cache module enabled. In my case I do. But I have a section on my website containing custom entities ('Contest') where I would like to have custom-tailored control of caching of the detail page (contest/1). This is what I found so far:

/**
 * Implements hook_entity_view_alter()
 * Disable caching on a ...
Score: -2
Nihal Kumbhalkar avatar
How to add anti csrf token to the forms (No Anti-CSRF tokens were found in a HTML submission form.)
cn flag

When i was testing my drupal 9 website for security i got the error as "No Anti-CSRF tokens were found in a HTML submission form." solution is given as "use anti-CSRF packages such as the OWASP CSRFGuard." but how to use these in drupal forms.

Score: 0
neessen avatar
Using dynamic templates in custom module
ro flag

I have created a custom Drupal 9 module, and I would like for this module to use different template files basing on a variable. I have looked at hook_theme() and I think the pattern return value might be what I am looking for, but I can't seem to make it work.

testpage.module

function testpage_theme() {
  return array(
    'testpage' => array(
      'template' => 'testpage',
      'variables' ...
Score: 0
john Smith avatar
entity_form how to programmatically add references and update the form visually (entity_browser)
gr flag

I´m having an fieldable entity with a reference field to paragraphs field_paragraphs and a paragraph_type with a reference field to content_type event field_events.

What i am trying in the entity form is to have a button in the paragraph_type event subform which on click prefills the field_events of the paragraph_type with content. The form display of field_events uses an entity_browser to let the user  ...

Score: 0
Thomas Crawford avatar
How can I get specific fields from user object in the REST API?
al flag

I have a question about retrieving fields from the user object using REST in Drupal 8. When i am logged in into Drupal i can use the following GET call too retrieve the user object:

http://localhost:8081/user/2?_format=json

This will return a json response with all the fields of this user. I only want to retrieve 3 fields and not the whole object.

How can i set some specific fields too return and not a ...

Score: 1
How to add inline CSS style in Custom Text of Views?
au flag

I have already setup fields for user to input color code (e.g. "#123000") to a content type. Now I need to modify the inline style color / background-color with the given value. I tried to do this in my Custom Text field:

    <div class="box" style="color: {{ color_field }}">
        <h2>{{ title }}</h2>
        <span class="description">{{ body }}</span>
    </div& ...
Score: 0
Jeirod avatar
How to retrieve #tree values inside multiple containers?
cn flag

I am using Drupal 8 and I am creating multiple forms that are made of a #tree hierarchy.

I need to retrieving the value of the "first name" from the #tree using the below code and it doesn't get the value.

$firstName = $form_state->getValue('userBoxArea')[$count]['userBox']['nameBox']['firstName'];

This is my code:

protected static $formID;

public function getFormId() {
    if (empty(self::$form ...

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.