Latest Drupal related questions

Score: 0
Frédéric Hébert avatar
Dynamically add field to Views result row
us flag

i use views_data_export to export a list of nodes to excel. These nodes of type "proposition" have many paragraphs fields, with multiple values.

By default, views_data_export export all paragraphs values in only one cell per field. I want to split these multiple values in multiple columns. One value per column.

I've written a hook_views_pre_render function :

function ehess_propositions_4_views_pre_render ...
Score: 0
quantumized avatar
Updates report page shows "No Available Releases Found" in red for core and most modules even though the site is on 9.3.3
ng flag

See screenshots. Upgraded a site from D8 to D9 and the updates status page is mostly red warnings with "No available releases found" errors. I've cleared caches. Not sure what's going on here.

enter image description here enter image description here

Score: 0
Render two taxonomy fields in one alphabetical list
jp flag

I have two term reference fields: colours and tags.

I have a poppy, it has tags: pretty and colours: red, green.

I want html like:

This flower is: green, pretty, red

i.e.

  • I want to take the terms from two fields and merge them into one collection.

I tried in Twig:

I started in twig. I could combine the terms but I couldn't sort them.

{% set alltags = content.field_tags['items']|merge(content.field_co ...
Score: 0
fxa avatar
The use of contexts in a Drupal.t() function in Javascript
ru flag
fxa

According to the documentation, we can use contexts with Drupal.t() since Drupal 8.

Drupal.t('May', {}, {context: "Long month name"}); works fine, but Drupal.t('May', {}, {context: "Abbreviated month name"}); doesn't translate May.

Why?

Score: 0
Drazen avatar
Display metatag description of nodes in taxonomy term views
ru flag

In Taxonomy term views, where are displayed shorten nodes I want to display node's metatag description instead body summary, but it doesn't work. I'm using Metatag module with it's submodule Metatag: Views. Views looks like this: Metatag field in views Please help

Score: 2
What is the difference/purpose of 'content' and 'elements' keys, in preprocess?
jp flag

I'm using hook_preprocess_node and looking at $variables. I can see there's two similar keys: content and elements. I see that there's a comment in the core code:

  // Helpful $content variable for templates.

next to code that copies all elements keys into content... I'm unsure why it's helpful, how it's different, and when one would use elements or content to achieve a particular goal.

This is a g ...

Score: 0
Entity reference link: add reference from Entity B to Entity A
cn flag

I have created 2 Content entities. Entity A has an "Entity Reference Field" with multiple values to Entity B. This all work as expected.

What I want to achieve is, to create a link from Entity B page, that when the user clicks on it, it will be added (appended) to Entity A "Entity Reference Field".

What's the best way to get this done?

  • (I know I can use the Flag and Flag lists module, but there are lim ...
Score: 1
Search: Do not index some parts of HTML
cn flag

We're indexing the rendered HTML output (rendered_item, type "Fulltext") of pages into elasticsearch using elasticsearch_connector.

Some parts of the HTML shall not be indexed because they contain automatically generated teaser elements for other content.

TYPO3 lets one define the parts of the HTML content to be included by adding HTML comment markers:

<html>
 <body>
  <!--TYPO3SEARCH_begi ...
Score: 1
How can I identify if my code needs a Unit test a Kernel test or a browser test?
co flag

In my project we extend base classes. BlockBase, ControllerBase, FormBase, FormatterBase and so on to build blocks, Fieldformatters, forms ...

We already have automated tests (functional) using a Testing automated framework based on Gherkin.

Since we are already running Functional tests, I understand there is no need to execute PHPUnit Functional,Browser, Kernel and Javascript scripts. Is my underst ...

Score: 0
Zdeněk Nováček avatar
How to get Commerce price without any adjustments
in flag

I'm trying to show "Buy for XX USD more and get free shipping", I know how to get $cart->get('total_price')->getValue()[0]['number'] but it is including any adjustments including shipment, I need just price of all items in a cart without any adjustments.

Using devel I found out that shipment value is stored in $cart->get('adjustments')->getValue()[0]['value'], but I don't know how to get  ...

Score: 0
pemson pereira avatar
Load node entities by owner
ht flag

I want to load entities by their owner. This is what I have so far:

\Drupal::logger('migrate_users')->notice("Hello start");
$userStorage = \Drupal::entityTypeManager()->getStorage('user');

$query = $userStorage->getQuery();
$uids = $query
  ->condition('status', '1')
  ->condition('type', 'student')
  ->execute();

$users = $userStorage->loadMultiple($uids);

// help regardin ...
Score: 0
How to Fix drush installation - path or alias to drupal root
cn flag

I had 10.6.2 working - on Centos 7 and today it is just GONE. I had to remove phpunit and apparently it took the drush pathing setup for drush with it. Now it says it is installed but the command is not found if I run " composer require drush/drush:10.6.2 "

If I go to /public_html/vendor/drush/drush and run ./drush it is there but gives the error " ! [NOTE] Drupal root not found. Pass --root or a ...

Score: 1
jsank95 avatar
Is there a way to stop Commerce from hiding the customer address info when adding a user?
in flag

We are using Phone 7.x-1.0-beta1 only because it is required to perform API calls to our ERP. After upgrading to Commerce 7.x-1.16 the address info under add user is collapsed by default. Since the phone module puts the phone number in the same section of the form it also becomes hidden. When the drop down arrow to expose the address info is clicked it complains that the phone number is invalid and refu ...

Score: 1
Existing pages not editable for admin with all permissions
dz flag

You know the drill. User of various CMSs but new to Drupal and inherited a site running version 8.6.10. New pages (nodes?) can be created but once something is created, nothing on/under the Edit tab is editable. In watching various Drupal tutorials, it appears most users with the correct permissions can simply click on a page from Content, click the Edit tab and edit the content boxes on the page. This  ...

Score: 1
Custom module routing issue
cn flag

I've a custom module where I have create the following route:

my.custom.route:     
   path: /{someVariable}/my-module/test
      defaults:
        _controller: '\Drupal\my_module\Controller\myController::build'
      requirements:
        _permission: 'access content'

On the controller I've the following code

public function build($someVariable)
  {
    echo 'here';
    dump($someVariable);
     ...
Score: 0
May  avatar
Twig templates with lots of classes?
zw flag

I have created a twig template and have added classes like below.

{%
  set title-classes = [
    'title',
    'h1',
  ]
%}

{%
  set subtitle-classes = [
    'subtitle',
    'h2',
  ]
%}

<div{{ attributes.addClass('title-classes') }}>
    {{ content.title }}
</div>
<div{{ attributes.addClass('subtitle-classes') }}>
    {{ content.field_subtitle }}
</div>

What do I do when I ha ...

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.