Latest Drupal related questions

Score: 0
Filtering webform submission results in a template file or in Views
tg flag

(Drupal 7) My situation is the following: I am using one single webform on my Drupal page that shows up on the page in different places for different events and gets a unique ID for each event to group results by. So when someone submits it to register for event A, the result will have ‘A’ as its event ID in the submission table; when someone registers for event B (on a different part of the page),  ...

Score: 1
How can I programmatically configure commerce checkout pane settings?
us flag

In Commerce, we have custom pane and checkout configuration that applies to all orders. Per this d.o issue in commerce_features, this is supposedly doable. However, Commerce's default configuration always comes over.

In my feature that Feature creates, it generates the following code:

/**
 * @file
 * my_module_config.features.commerce_checkout_panes.inc
 * 
*/

/**
 * Implements hook_commerce_checkout ...
Score: 0
How to display the nodes with the reference entity "Group type" of the same type as the current group?
cn flag

I have a website built with Drupal 9 and I installed the Group module.

I created a "Help" content type with an "Entity reference" field that refers to the group type.

enter image description here

I have created a Views page in the Groups tab and I want this page to display the "Help" nodes that reference the group type of the current group.

enter image description here

How to display the nodes with the reference entity "Type of group" of the same type, as ...

Score: 2
shyammakwana.me avatar
Connect field with Taxonomy Term
do flag

I have taxonomy Brand and different fields like RAM, Monitor, 'CPU' under content-type Hardware.

While adding a new Hardware how can I add RAM, CPU or other fields with Brands? e.g.

RAM = 16 GB, Brand = Corsair
Monitor = 24", Brand = Dell
...

I can allow Brand taxonomy to unlimited and can add multiple, but is that possible to connect with particular fields? Or is there any better approach?

Update:

Score: 4
non-existent service, yet cache is cleared and module is enabled
ca flag

I'm trying to access a Drupal service for normalizing content, yet the service is non-existent, even though the module "hal" is enabled and the service is defined. How can I get the service "serializer.normalizer.entity.hal"?

root@0968b6d03cdb:/var/www/html# drush cr
 [success] Cache rebuild complete.

root@0968b6d03cdb:/var/www/html# drush pml|grep hal
  Web services                      HAL (hal) ...
Score: 2
Get the time a custom block was last edited
in flag
3x5

I have seen lots of answers for getting when a node was last edited, but I can't seem to apply any of these methods to blocks. Basically, I have a block that I only want to display if it has been updated in the last week. When I view blocks in the admin, I see that the admin view shows you when a block was last edited.

I can get my block in hook_preprocess_block, and get things like $block->la ...

Score: 0
How to display group operations block not in a dropbottom menu either "normal" links list/HOOK_block_build_group_operations_alter does not fire
fr flag

currently the links of the "group operations block" of group module are displayed in a dropbutton menu. I want them to get displayed in a "normal" link list. I found an issue (https://www.drupal.org/project/group/issues/3015420) related to this on d.o. I have already a custom module to handle my group stuff, so I thought to implement a block_build_alter hook to modify the link type like in the patch (

Score: 0
Content type field to include both media entities and links
pl flag

I'm new to Drupal and I'm creating a new content type. I know there's two separate fields for media and links, but is there a field that include both? For example, the field is called "News Releases", a user can upload a document and/or include a link. Or would I need to create two separate fields and have one called "News Releases" and "News Releases 2" for media and links?

Score: 0
Ivan Ginovski avatar
Tax round calculation on order
jp flag

How can we round up the tax to 2 decimals, but the last decimal should be either 0 or 5. I have this rule for the round up:

if ($decimal % 10 <= 2) {
  // Here, the last decimal should be 0.
}
else if ($decimal%10 > 2 && $decimal%10 <=7) {
  // Here, the last decimal should be 5.
}
else {
  // Here, the decimal should be incremented by 1, while making the last decimal 0.
}

For example ...

Score: 0
Lambic avatar
Custom reference field saving empty values
ph flag

I've created a custom field based on entity reference field but the target_id it saves comes from an external system.

I have the field type, field widget and autocomplete element defined and working and the correct values are being saved to the associated database table for valid values.

The bit I'm stuck on is that if the field is left blank it still saves a record to the database but with an empty ...

Score: 2
awm avatar
What methods are available to resolve "The node.field_name field needs to be updated."?
mx flag
awm

When Drupal status report says field “field_name” needs to be updated I found out that it sometime hard to resolve. In the past we used to have entup but that was removed. The following works in many cases:

  1. Edit a field and resave then export it. This will add a missing schema property: this way you can tell what changed.
  2. Delete the configuration from the database and re-import it \Drupal::configF ...
Score: 3
How do I add a dependency on a forked project?
cn flag

I've hit a bug that requires a patch to composer.json.

There's a patch in the issue queue, but it hasn't been merged yet.

How do I update my composer.json to depend on the forked version of the module?

Score: 2
richirm avatar
get the file URI of an ImageItem
in flag

How can I get the file URI of a Drupal\image\Plugin\Field\FieldType\ImageItem instance?

I get the field value with $node_entity->get('field_image')[0] but I don't know how to get the file URI.

Score: 1
Impossible to access files in /drupal/sites and /drupal/themes after restoring the installation
cn flag

I restored the files of the Drupal installation, but I'm facing an issue: All the files in /drupal/sites and /drupal/themes are not accessible.

I got only 404 errors when trying to load those files.

I tried changing the permission (777 just temporarily), but it doesn't work. I can see the images with IMCE library, but it seems that Drupal can't access them.

screenshot

The front-end is the same.

screenshot

The owner ...

Score: 6
Joost avatar
Is it bad practice to use the same hook twice?
jp flag

I'm working a quite a big project and I use hook_entity_update() in three of my modules. I do this to keep my project structured and have different functions of my site in different modules.

  • Is it bad performance wise to have this hook called multiple times from different modules?
  • Since this way of working makes the number of custom modules grow, does the number of modules affect the performance of ...
Score: 2
liquidcms avatar
How to add views aware configuration options to a field formatter?
us flag

There is a contrib field formatter module (bg_img_formatter) which has numerous field configuration options. One of these options is a text field which needs to allow for the same views field replacements as the "Rewrite Result:Override the output of this field with custom text" does. But as this is a "field" formatter and not a "Views field" formatter; the formatter class and specifically its viewEleme ...

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.