Latest Drupal related questions

Score: 1
David Buddrige avatar
How do I update a Lightsail server?
cn flag

I have decided I want to learn Drupal. To that end, I fired up an AWS Lightsail server with a Drupal site, to play around with. Having taken AWS's default Drupal 9 install and logged in, it is displaying this message in the config screens:

There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page  ...

Score: 0
How to strip tags/ or just trim content but preserve ampersand in field content
jp flag

enter image description here

The issue : striptags removes "&" from the fields content as well.

{{ label }} preservers the "&" but I am not able to trim the content. I have twig_extender enabled

 <div class="card__back back">
    <div class="back__content__container">
      <div class="program_title--copy">
        {% set text = label|render|striptags|trim %}
        {{ text|length > 40 ? text|trun ...
Score: 0
Norayr avatar
Get all updated (changed) fields in submit function
in flag

In hook_form_alter in the specific form, I've added the new submit button

  if ($form_id == 'myform') {
    $form['custom_submit'] = [
      '#type' => 'submit',
      '#value' => t('custom submit'),
      '#weight' => 100,
      '#submit' => ['custom_submit_func'],
    ];
  }

In custom_submit_func I need to get all field values that changed (not equal to an entity old field values or form ...

Score: 0
403 Access Denied on Webform submit with token
in flag

One of our sites has been updated Drupal Core 7.83 to 7.87. There is a custom module that extends webform functionality for some of the forms on the site. The former dev wrote a function to generate a unique URL-safe base 64 token using openssl, specified by length, for the webform. It is used to check if the the $token submitted in form and exists in the user's $_SESSION. This check prevents the  ...

Score: 2
stemiwe avatar
$group->addContent() in hook_node_insert() doesn't update the access permissions for the node
cn flag

I have a content type with a field that lets the users decide which group to add the content to.

The content is added to the group via hook_node_insert().

function tm_wiki_node_insert(NodeInterface $node) {
  $type = $node->getType();
  if ($type == 'mycontent') {
    $group = Group::load('1');
    $group->addContent($node, 'group_node:mycontent');
  }
}

It works: I can see the node is properly ad ...

Score: 0
Yasen Ivanov avatar
The values returned from hook_node_access_records() aren't considered to allow access
cn flag

I am implementing a solution in Drupal 9 where users are allowed to see only the nodes that belongs to their same group. If a node doesn't belong to any group, t hey should be able to see it. I've used hook_node_grants() to assign the right grants to the current user and hook_node_access_records() to set the view grant per node, as suggested in How do I filter a view by the results of hook_node_access?

Score: 0
mauzilla avatar
Applying a patch - how?
cn flag

Im trying to install Radix on Drupal 9 (Drush 10) - Installation keeps failing in composer / drush en radix and I have tracked it down to a current "bug" (or atleast a closed bug now) which someone wrote a patch for (#12) - I feel daft but how do one apply this patch?

Score: 0
Radix Day Care avatar
Drupal 9 - Modules for background Video or Image
it flag

I'm yet another newbies excited about Drupal.

For my sample site, I used the Adaptive Theme (no particular criteria for me selecting this theme). I just wanted to check is there a quicker way to add background image or video for the home page of the site?

The modules like "background_image" and "background_video" seems to have not being maintained actively.

I tried following in "Custom CSS" section of  ...

Score: 1
Taku Fujita avatar
How to publish latest revision langcode programmatically in each translation
id flag
  1. My workflow is draft, publish and archived.
  2. My translations are 'en(default)', 'fr', and 'de'.
  3. My clients create a lot of nodes in draft status for their release.
  4. We must release these latest revisions in these nodes.
  5. Each nodes has some paragraph field.

I try the following code on drush eval, but "de" translations are changed as first revision in paragaraph field.

$langcode = "fr";
$nid = 12345;
// no ...
Score: 0
print description and field value directly in taxonomy-term--drzava.html.twig
cn flag

First I disable view for taxonomy-term, so I can use taxonomy-term--drzava.html.twig, where drzava is name of vocabulary.

How to print description and filed value for taxonomy-term directly, without using

field--taxonomy-term--description--drzava.html.twig

{{ content.description }} or {{ content.field_flag_code}}

I have problem to analyze devel output. I try {{ content.description.value }} but its do  ...

Score: -1
Updated from Drupal 8.9.20 to 9.0.0, but can't run update.php due to errors
cn flag
Dan

Here's what I get when attempted to run update.php:

Requirements problem

Errors found

MISSING UPDATES FOR: SYSTEM The installed version of the System module is too old to update. Update to a version prior to 9.0.0 first (missing updates: system_post_update_layout_plugin_schema_change, system_post_update_entity_reference_autocomplete_match_limit).

MISSING UPDATES FOR: TAXONOMY The installed version of the ...

Score: 0
Alan Dixon avatar
Where did my commerce token go after an update to 7.87
br flag

My Drupal 7 commerce setup sends out a couple of emails after an order is placed. It uses this token:

[commerce-order:commerce-customer-shipping:commerce_customer_address]

After updating to Drupal 7.87 (from 7.82), that token started going out as is, not being evaluated.

How do I fix this issue?

Score: 0
Getting InvalidArgumentException for UpgradeStatusForm after installing the upgrade_status module on a Drupal 8 site
cn flag

I have a very old install that began with 6 and is now at 8. I'm trying to get it updated to 9 but have gotten stuck with getting the upgrade_status module to work. After it was installed via composer, I get this error when navigating to the report:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Class "\Drupal\upgrade_status\Form\UpgradeStatusForm" d ...
Score: 1
rukya avatar
Twig: how to get values from [someName:protected]?
id flag

When I kint:

{{ kint(elements.steps[0].step.description['#object']) }}

I get:

...
[activities:protected] => Array
    (
       (
        [17] => stdClass Object
            (
                [__CLASS__] => stdClass
                [id] => 17
                [vid] => 17
                [type] => opigno_video
                [name] => Dzień 1
                [usage_activity] = ...
Score: 2
beta-developper avatar
How can I specify the relation type between two entities?
ye flag

I am new two Drupal

Trying to create two entities, Post and Category (This is for tests purposes)

A Post can have one Category, and a Category can have multiple Post

Here is my implementation of the field category_id on the Post entity:

  $fields['category_id'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Category'))
  ->setDescription(t('The Name of the associated category.') ...
Score: 0
zapico avatar
Link to images in form view creates wrong url
cn flag

I noticed this after drupal 9 update, but I've tried to find the exact moment when it was broken and I couldn't find it. I use S3 and cloudfront for images so maybe the problem is related with that config.

Apparently, the images work well (that's why I didn't realize it was broken). Images load correctly in my frontend and even the little preview in the backend is correctly shown. The problem is  ...

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.