Latest Drupal related questions

Score: 0
Interlated avatar
How do you use 'basic markup' in a webform default value?
km flag

How can you use 'basic markup' in a webform default value? The goals is to format the default text.

Steps

  1. Create a Basic HTML element
  2. Edit the element
  3. Using the 'advanced' tab set the default value.

Only plain text is allowed in this field. Any markup is rendered as markup not as HTML

Markup element default

Score: 0
How to load a sandbox project via composer and enable other devs on project to commit to the sandbox project
me flag

I'm working on an install profile right now in Drupal (https://www.drupal.org/sandbox/jnicola/3277854). I want to while developing the next project we're on also build this out during the initial part of building our site out.

I can load the sandbox project via composer no problem, and it's checked out via git, but when I run git status I get "HEAD detached at 56eaaa5"

I'd like the sandbox repo t ...

Score: 0
How can I add classes to an item in field.html.twig
in flag

I have a typical content type, with a field, let's say field_name.

I can output each field using the field.html.twig file. In the file, to output each item, there is a line

<div{{ item.attributes }}>{{ item.content }}</div>

So how can I set item.attributes, to output, say, the machine name of the field, so that my output is:

<div class="field_name">My Name</div>

I suspect it h ...

Score: -2
Custom textfield element, different $form_state value and element '#value' value
cn flag

I have a textfield element (named 'bus_station'), which holds a bus station name.

I am looking for a way to create a custom 'bus_station' element (possibly extending Textfield class), which would:

  • Still expect a text input in form of bus station name (and retain it during $form_state->setRebuild() and show it to user), but
  • In $form_value, after form submit, either provide a FALSE (custom code ...
Score: 0
liquidcms avatar
How to programmatically save a node's layout?
us flag

Not sure if this is the best approach but it does work well.. almost.

I am using the Layout Builder Modal module which, in layout builder, opens block configuration in a modal. This is great but I would like to extend this capability to the front end so that I can configure a layout block without having to go into the node's layout.

If I simply place the contextual link which this module creates on  ...

Score: -2
Matoeil avatar
how to use a different twig template depending on the breakpoint
za flag

How to have a way to use different twig templates depending on the viewport , or having a twig variables that give the info ?

An example was using foundation sticky classes on twigh templates. The stickyness was making a mess on the mobile view

 <div id="sidebar-first" {{ create_attribute({'class': sidebar_first_classes }) }} data-sticky-container>
              <div class="sticky" data-stick ...
Score: -2
Programmatically adding block into layout builder layout?
cn flag

I'm trying to add a block into a layout builder, but it seems the 'getSections' for a node which is currently at the default layout does not output anything, not sure if it's a bug or if that's intended behaviour... getSections will only output items if the layout for the node has deviated fromt he default...

ie:

 $entity = \Drupal::entityTypeManager()->getStorage('node')->load('127');
 $layout ...
Score: -2
Relate each node with multiple fields set to the node
in flag

I am trying to create a view that displays how many times each child has been related to parents through multiple fields.

Assuming we have two parents (Simple Parent and Extended Parent), and three children (Red child, Blue child, Green child), the parents have two field types (field_children, field_morechildren) that relates to multiple child entity references.

If the content is set like this.

Score: 1
quantumized avatar
How to ignore block region placements during config sync?
ng flag

When we perform config export and import our block placements are getting hosed. Is there a way to no export block placements/regions?

Score: 1
How can I extend Serializer to handle a custom field type?
cn flag

I'm trying to extend Serialization to get the JSON Field module to return a JSON object instead of stringified JSON.

Goal: When I access an entity that contains a JSON field using JSON:API, I want a JSON object for the field value (currently, the stringified JSON is returned).

I think what I need to do is to extend one of the core normalizers and use it to add a json_decode() step.

There is some

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.