Latest Drupal related questions

Score: 0
Unexpected error from a layout page
us flag

I am working with Manage display, but for one of my pages I get an error occurring on the Layout page.

Error: Call to a member function getEntityTypeId() on null in Drupal\layout_builder\Plugin\Block\InlineBlock->build() (line 223 of core/modules/layout_builder/src/Plugin/Block/InlineBlock.php).
Drupal\layout_builder\Plugin\Block\InlineBlock->build() (Line: 105)
Drupal\layout_builder\Event ...

Score: 1
Wyckham Seelig avatar
Product Attributes that do not require product variations
kr flag

I am trying to figure out if it is possible to have product attributes that do not require individual SKUs and do not have to be entered as product variations. My use case is this: We are selling dinners with three different entrees and three different desserts. We do not need to charge different amounts for each combination, but we do need to know how many of each have been ordered. I can make this ...

Score: 0
c1u31355 avatar
Field UI / image field - empty the whole field / all values
in flag

I'm using an image field with multiple images to manage a custom built gallery. With e.g. IMCE I am able to bulk upload and insert images into this field.

Now I I have to periodically replace the images with new ones - but to do this, I have to click on every single "remove" button to empty the field. This is plain ridiculous since I have about 30 to 100 images per field.

I searched for a module whi ...

Score: 0
Alex Monaghan avatar
Find value of another field in a fieldformatter
in flag

This may be complicated to explain

I have a content type with field_1, field_2 etc

field_1 is a taxonomy reference

field_2 is a custom field with various sub-values

I have a custom formatter for field_2 which does all sorts of things to hang the sub-values into the desired output, however, I now have a condition for a certain value of field_1 which requires a different formatting to happen to field_2 that ...

Score: 1
Refresh view using ajax with parameters
ni flag

I use this code to refresh a view, but It reloads the view ignoring neither page number nor filters.

$('.view-id-name').trigger('RefreshView');

How could I pass parameters (page number, query filters, etc) to this call?

Score: 0
Jean-Pierre Mena avatar
Site error on Drupal 9 on Acquia Dev Desktop
nl flag
[Sat Sep 04 15:52:46.939952 2021] [fcgid:warn] [pid 8276:tid 4] [client 127.0.0.1:49930] mod_fcgid: stderr: #21 C:\\Users\\jeanp\\Sites\\devdesktop\\drupal- ...
Score: 1
iamfredrik avatar
How to get product variation media file url using jsonapi?
us flag

I'm using the following jsonapi GET request to retrieve product variations for a product:

/jsonapi/commerce_product/default/0ea927c7-b62d-45c9-8bec-dc3d16215276/variations?include=field_images

However, the response does not include the file url for the media:

{
"type": "media--image",
"id": "6af50149-ae35-4a3b-802d-b21c5d863235",
"links": {
"self": {
"href": "http://myurl/en/jsonapi/media/image/6 ...
Score: -2
Unable to create a custom form tableselect
ni flag
    /**
     * An example controller.
     */
    class GenerateCertificateTable extends ControllerBase {
    
      /**
       * Returns a render-able array for a test page.
       */
      public function content($nid) {
            $query = \Drupal::database()->select('users_field_data', 'u');
            $query->fields('u', ['uid','name','mail']);
            //For the pagination we need to exte ...
Score: 0
How do I pass a node field variable into a layout builder section template?
cn flag

So far what I understand is I need to start with this:

function mytheme_preprocess_layout__twocol_section

in my .theme file, but I'm not quite sure where to go from there.

For clarification, I have a term reference field on my content type. I'm trying to pass values from the term (specifically, an attached menu) into the layout builder section template so the node displays the correct menu depending on t ...

Score: -1
There is no token table
co flag

I installed the latest Drupal 8 version (8.9.18) on my host with the Rules (8.x-3.0-alpha6), the Token, and the Rules Token modules.

I can't see any table showing the list of the allowed tokens, in the rules action form. I want to use the node title or the node author for the Send mail action, but there is no token information or guidance.

I tried to add [node:title] and [node:nid] in the mail bo ...

Score: 1
sonfd avatar
How can I load an entity's bundle object from a loaded entity?
in flag

If I want to get an entity's bundle object, with a node, I can do something like:

$bundle_object = \Drupal::entityTypeManager()
  ->getStorage('node_type')
  ->load($node->bundle());

But this seems a little long-winded. Is there a way to get the object directly from an entity? Something like $entity->getBundleObject()?

Score: 0
c1u31355 avatar
Access (none related) entities from within twig without preprocessing
in flag

Within a nodes Twig template I am able to access e.g. referenced fields with...

{{ node.field_my_entity_reference.0.entity.field_my_field.0.value }}

With the help of Twig Tweak I am able to render fields from specific nodes by referencing their NID (here NID 1)...

{{ drupal_field('field_my_field', 'node', 1) }}

Now is it possible to directly access the fields of specific nodes by their NID, not just g ...

Score: 0
user3038672 avatar
How to add a user role as a body class to the admin theme, Seven?
cn flag

I need to add a user role class to the body tag in the Seven theme, our admin theme. What is the best way to manage that without touching Seven? Is it even possible?

Ultimately, I'm trying to hide a field element in the Manage Form Display from showing to certain roles so as to avoid confusion for that role, but I want to keep it for Administrators. So I'm open to other options for this.

Score: 0
How to access url of Remote Video, Document and Image inside twig template?
gh flag

I have a field called Media (machine name: field_media) inside of a content type. This field Media takes the media types of Remote video, Image, and Documents. I am currently trying to render this media inside my twig template as a link to whatever media type it is. For example, if it's a remote youtube video, the link would take you to the video or if it's a pdf document, the link would take you to ...

Score: 0
Programmatically set latitude and longitude exposed input
in flag

I've been using geolocation 8.x-1.12 for a while now. I have a REST route that gets a view with my exposed form and returns the results.

Previously I did:

$plugin = \Drupal::service('plugin.manager.geolocation.geocoder');
$geocoder = $plugin->getGeocoder('google_geocoding_api');
$geocode = $geocoder->geocode($zip_code);

$view = Views::getView('local_pharmacies');
$view->setDisplay('block_1') ...

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.