Latest Drupal related questions

Score: 0
octogone.dev avatar
How do I apply different styles according to content type?
bf flag

in a view I'm filtering content with search API /facets. In the view (field format) i've applied a specific style for the results, some sort of Bootstrap card. IT apply to all content index by search API.

I need to apply different styles according to content type in the results: For the content type "rose" i use a bootstrap card, for the content type "wood" i use full width div with an image a b ...

Score: 0
How to refresh and reload (with ajax?) order checkout panes and order calculation independent from commerce cart refresh (e.g. billing address change)
fr flag

I have following problem:

During checkout, my customer has to fill in his billing address (at least at the first time) to calculate VAT rate and gross price. Further calculation is done via an order processor after that. So far it works fine.

My problem is, that the cart order refresh doesn't refresh the checkout panes (like the order summary) via AJAX, when the billing country (and so perhaps the v ...

Score: 0
Giuseppe avatar
Why don't users with the "Create new content" permission for a custom bundle cannot access /node/add, but they can access /node/add/author?
br flag

If I give to a custom role the Article: Create new content permission, users can access the /node/add page. However, if I give the same permission for a custom bundle, for example Author: Create new content, users can't access that page, but yet can access /node/add/author.

What should I try to address the problem? I've tried to debug NodeAccessControlHandler::createAccess(), but this code doesn ...

Score: 0
How can I programmatically add or remove a new request_path to block visibility?
in flag

It seems like I could utilize the getVisibilityConditions method on the block, which returns a ConditionPluginCollection object with a setInstanceConfiguration method, which is apparently easy enough to use, requiring $request_path and $configuration arguments. But, the current block visibility request path variable is a string, containing paths separated by commas. How can I update that to either  ...

Score: 1
Andrew Morris avatar
Adding sequence item to configuration
mw flag

I have a configuration item in my custom module, part of which is a sequence, basically I'm attempting to create something akin to an array of items

my_module.schema.yml

my_module.settings:
  type: config_object
  label: 'Configuration'
  mapping:
    custom_fields:
      label: 'Custom Fields'
      type: sequence
      sequence:
        type: mapping
        label: 'Custom Field'
        mapping:
   ...
Score: 1
Change the state of a checkboxes field
pe flag

I know how to use conditions with Form API for fields like text-field, checkbox, for example, showing or hiding a field when a checkbox is checked.

$form['lorem'] = [
  '#type' => 'checkbox',
  '#attributes' => [
    'name' => 'field_lorem',
  ]
];

$form['ipsum'] = [
  '#type' => 'checkbox',
  '#states' => [
    'visible' => [
      ':input[name="field_lorem"]' => ['checked' =&g ...
Score: 0
Kevin avatar
Views contextual filter, can you add more than one 'has taxonomy term' with different validation/share rules?
in flag

I have a View that grabs the current node, and looks at taxonomy on the node page as a contextual filter argument.

I want one vocabulary to require shares any terms (OR), and I want another to share all terms (AND). However, if I add a second contextual filter, I get no results.

Is this possible with Views?

Score: 1
CanardPpc avatar
Migrate CSV to content type with paragraphs
de flag

I'm trying to import a CSV File into Content Types and Paragraphs, using Migrate module (and mainly this tutorial : https://mtech-llc.com/blog/charlotte-leon/migration-csv-data-paragraphs).

For this I have created a custom module in modules/custom, and I added the .yml files in config/install.

Here's my two .yml (produit_epargne is for the Content Type, and epargne_support is for the Paragraph) :

Score: 0
Ex0r avatar
Help with Views Field Plugin
cn flag

I am trying to make a views field plugin that provides some additional functionality to a field for me. I am having issues with it.

I have an entity type called an lms_request. It has numerous bundles inside of it.

When using the custom 'views field plugin' on a view that specifically filters a single bundle, it works fine.

When I attempt to use the same field on a view that has multiple bundles filter ...

Score: 0
Matt avatar
Programmatically change view mode of media field
cn flag

I'm attempting to change the view mode of a media field programmatically. I've created a view mode called 'modal'. I created a mytheme_preprocess_media hook and attempted to change the view mode a variety ways like

mytheme_preprocess_media(&$variables) {
    $variables['view_mode'] = 'modal';
    $variables['elements']['#view_mode'] = 'modal';
    $variables['content']['field_media_oembed_video ...
Score: 0
Views user input custom global text
us flag

I use Views to generate some links so I can prepopulate a list of Webform links. In one field, it is a global custom text with a number and the second column is the webform link with a replacement token. Is it possible to allow the user to define the custom text? The custom text column will always be a number. Once "5" is entered, the whole column should appear 5 for every row.

I use this table t ...

Score: 0
How to Install new module, add code to existing module that requires the new module, and import config for the new module in the same build
hk flag

I seem to be running into a circular dependency issue in the scenario where my new build has a new module (B), new code in an existing module (A) that depends on the new module (B) and new config being imported for the new module (B).

In the past I have handled this with creating and deploying two independent builds, one where I deploy the new modules and enable them, and in the second build, dep ...

Score: 0
pglatz avatar
drush not finding correct multisite settings.php
in flag

I have a Drupal 9 site using multisite to support both local and production hosts. I have defined them in sites/sites.php:

$sites['www.electronovelty.com'] = 'www.electronovelty.com';
$sites['www.en9-local.pglatz.com'] = 'www.en9-local.pglatz.com';

and created settings files in

sites/www.electronovelty.com/settings.php
sites/www.en9-local.pglatz.com/settings.php

Using xdebug, I've verified when open ...

Score: 0
Jacob avatar
Programmatically add value to multi-valued/repeater field at weight/index
cn flag

In Drupal 8, I have a content type and more than a few nodes that have a Paragraph field with unlimited number of values, and so I need to programmatically add a paragraph at an index to the existing values in the field. I know in the form editor widget I'm able to add a field value then drag the field to the order that I need, or change the weight then save the content.

I'm currently loading the ...

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.