Latest Drupal related questions

Score: 0
Read reverse-relationship from a view programatically
in flag

Alright, this is taking so much time than expected. I'm having a comment type "Default comment". The comments under this comment type is published and created as nodes under "level3" content type. The content types look as below:

enter image description here

I have related the Level3 content type with Default comments using "comment ID" field. So every time when the comment is published under level3, the comment ID will also be upda ...

Score: 0
Database Error after updating from Webform 6.0.5 -> 6.1.0 in Drupal 9.2.7 (PHP 7.4.14)
be flag

After updating to Webform 6.1.0 the following error occurs:

webform module 8626 - Issue #3240399: Move form #method, #action, and #attributes from properties to settings

#8626 Fehlgeschlagen: Drupal\Component\Serialization\Exception\InvalidDataTypeException: Malformed inline YAML string at line 21. in Drupal\Component\Serialization\YamlSymfony::decode() (Zeile 40 in C:\xampp\htdocs\drupal8\core\l ...

Score: 2
add field to user in hook_update_n
pl flag

The latest release of our existing module needs to define MANY new fields that are attached to the drupal user. For each field, in {module}/config/optional there is a field config and a field storage config. I then implement hook_update_n in {module}/{module}.install to detect new config entries and add them if they don't exist. Running the code installs the config (I can see it with drush cget), but ...

Score: 0
Read entity reference node field
in flag

I have a referenced entity named - field_cp_level2_ref_level3. This field belongs to level3 content type. when I dump the $entity, I see the field as below:

entity:node:level3::field_cp_level2_ref_level3 => Drupal\Core\Field\EntityReferenceFieldItemList (9) Depth Limit

how to read the value of this field? I tried to read the value as below:

$var =  $entity->$node->field_cp_level2_ref_lev ...
Score: 0
quantumized avatar
Is it possible to convert a text field to an email type field that has exiting data in Drupal 9?
ng flag

We have a Drupal 9 site that has a plain text field with existing data that was used for email data. We'd like to convert this field type to email. Is this possible?

Score: 1
How do I display an SVG image?
cn flag

I added the following code for a "Global: Custom Text" field.

<div class="messages-list__item messages messages--warning" data-drupal-selector="messages" role="contentinfo" aria-label="Warning message" data-once="messages">
    <div class="messages__container" data-drupal-selector="messages-container">
        <div class="messages__header">
            <h2 class="visually-hidden ...
Score: 0
Eli Hoto avatar
alter image style attribute
cn flag

i am trying to develop a CKEDITOR plugin to add padding/margin to images,

after looking in the documentations i have written this code :

const style = new CKEDITOR.style( { element: 'img', attributes: { 'style': 'margin:100px' } } );
editor.applyStyle(style);

but it didn't work so i tryied :

const style = new CKEDITOR.style( { element: 'image', attributes: { 'style': 'margin:100px' } } );
editor.app ...
Score: 1
Machine-translate a node by menu link
cn flag

I have an "About us" main-navigation menu link.

I want to create several other main-navigation menu links, in languages other than English, which will link to that very webpage, for example:

  • เกี่ยวกับเรา (about us in Thai)
    • If the user clicked that link, the destination would be the same "About us" webpage, but the content would be machine-translated to Thai.

The English cont ...

Score: 1
How do I mock \Drupal::httpClient()?
jp flag

I'm unit testing a utility library (of our own making) that makes calls to an external REST API with \Drupal::httpClient()

So, I have a library class with static functions:

class myUtils {
  public static function getFromApi($path)
  {
    ...
    $response = \Drupal::httpClient()->request( ... );
    ...
  }

...

}

and I want to call that from a test class:

class myUtilsTest extends \Codecep ...
Score: 0
Wai Kong Chong avatar
Unable to log in using Chrome browser
jp flag

I having an issue with my Drupal site (8.9.19)

Using Firefox browser, there is no problem login for all users

However, when using Chrome - users are unable to access. This is what I received in the Recent log message:-

  1. When an user has successfully login, the Recent log message shows "Session opened for theusernameperson." - This is OK

  2. However, in the Recent log message - there is another line th ...

Score: 1
Delford Chaffin avatar
How do I render a commerce promotion coupon code on the order details?
gg flag

I want to show a coupon code used on an order details page, but cannot seem to render it on a templates. Here are some things I have tried so far...

{% for coupon in order_entity.coupons %}
  {{ coupon.target_id }}
  {{ coupon.code }}
  {{ drupal_entity('commerce_promotion_coupon', coupon.target_id) }}
  {{ drupal_field('code', 'commerce_promotion_coupon', coupon.target_id) }}
{% endfor %}

The only th ...

Score: 0
liquidcms avatar
How to increase image resolution in gallery?
us flag

Not sure if I am asking the correct question here as I am more of a PHP coder than a graphics designer. My client's site has a Views img gallery which displays 3 columns wide on desktop and 1 wide on mobile. The image resolution on mobile is not very good and I am trying to increase it. I suspect it is the same resolution on desktop but no one is concerned about that.

I think the correct solutio ...

Score: 0
How can I debug a Twig error that occurs after migrating from Drupal 8.9 to Drupal 9+
cn flag

I am trying migrate my Drupal 8.9 site to Drupal 9+ and I am stuck with an error its cause I am not able to hunt down. On almost every page I get the following PHP exception:

Twig\Error\RuntimeError: The "replace" filter expects an array or 

"Traversable" as replace values, got "string" in "__string_template__faabd18c7a37a1e54d0ef10115b24022e72bc201187fff502de48bf58589321f" at line 2. in twig_repl ...
Score: 0
Mathieu avatar
Is it possible to set up Amazon advertising with the Media module?
ph flag

I have a Drupal 9 site with the Media module enabled.

I have subscribed to the Amazon partner program.

Is there a solution to display Amazon iframe in Drupal? I am thinking of the Media module.

Many websites display the product name with the updated price in real time. I did not find anything to fire this.

My question :

Is it possible to set up Amazon advertising with Drupal 9 and the Media module? ...

Score: 1
How to add link to translated content in text field
cn flag

I need some help on a multilingual D9 site, trying to add links to translated node in text field. In German version should be a link to the English and French version of this node, as part of the node content.
And I need them absolute, because the nodes are used as newsletter content: https://example.de/en/node/123
I created link with language part in url, but when I view the node, the links are re ...

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.