Latest Drupal related questions

Score: 0
Fields in content form are below save button
de flag

I got a problem in drupal 7.x which is that i'm trying to edit and create content from a content type that has 140+ fields and the save button section has fields below it as shown in this image: drupal form before save button

drupal form after save button

I don't know what to do in this case, i found a similar case in this page: https://www.drupal.org/node/2609736 but it never got answered.

Can you please help me?

Thank you for the attention!

Score: 1
Matt avatar
How to add new fields to the 'edit media' dialog box on media embeds
cn flag

I'm attempting to add a new select box to the dialog box that pops up when choosing 'edit media' on a media embed in a WYSIWYG. I'm referring to the dialog box that presents options like 'caption' and 'alignment'

I was able to make the field appear by using

function mymodule_form_alter(array &$form, FormStateInterface $form_state, string $form_id)  {
if($form_id=='editor_media_dialog'){
  $form['s ...
Score: 0
quantumized avatar
Clarify difference between hook_form_TYPE_alter and hook_form_TYPE_EDIT_alter
ng flag

I have a site with a lot of hook form alters for node forms and I'm finding that I have to create two separate hook functions to affect both the node create and node edit forms.

For example, I have to put both:

module_events_form_node_event_form_alter()

and

module_events_form_node_event_edit_form_alter()

With the same functionality in both functions so that it covers both new and edited nodes. I ...

Score: 0
modernizr.min.js?v=3.3.1 was blocked due to the MIME type ("text/html") not matching (X-Content-Type-Options: nosniff) - how to fix it?
cn flag

I developed a site using drupal 7. Now I migrated the site to another webserver.

The server is getting an error that I can not solve.

In the file 'core.libraries' I have the following code:

'modernizr:

Block the page from being loaded until Modernizr is initialized.

header: true remote: https://github.com/Modernizr/Modernizr license: name: MIT url: http://modernizr.com/license/ gpl-compatible: true versio ...

Score: 0
Libbna Mathew avatar
How to hide the fields in manage display when layout module is installed and display when module is uninstalled programmatically?
in flag

In the below config I want to remove the body field from content and add it in hidden as body: true when I uninstall the layout module. Basically when I install the layout module the fields in manage display should get disabled/hidden and when I uninstall the module the fields should be displayed. How can I achieve this programatically?

This config code is of entity_view_display.node.article.default ...

Score: 1
How can I get Average of a comment field by node_id?
us flag

I have Comments here wherein user can rate a content.

I want to get the average rating per content, how do I efficiently get the average?

I have the following code to get the Average:

$cids = \Drupal::entityQuery('comment')
    ->condition('entity_id', $variables['row']->nid)
    ->condition('entity_type', 'node')
    ->condition('comment_type', 'content_rating')
    ->execute();

$comment ...
Score: 2
Mauricio avatar
Disable a field if another field is disabled
lb flag

I need to disable field A if field B is disabled too. Actually, my current field A has the following #states (altered using hook_alter_form) to disable it if field B or field C are empty:

/**
 * Implements hook_form_alter().
 */
function my_module_form_alter(&$form, $form_state, $form_id) {
 
  $form['field_a']['#states'] = [
    'disabled' => [
      [':input[name="field_b[0][value][date]"]' =&g ...
Score: 0
May  avatar
User error: "1" is an invalid render array key. How do I find where the error is coming from?
zw flag

I get this error on every page. How do I debug or find what is causing it?

I thought it might have been changes to a twig template, but I tried other themes, and still had the error.

I've disabled all custom modules.

I searched and found User error: "1" is an invalid render array key in Drupal\Core\Render\Element::children() Which suggests its custom theming related but I am using core theme with ...

Score: 0
TableSort with entity query aggregate
ai flag

I'm trying to implement a table sort for a custom Drupal 9.x entity type Packet which represents published medical literature articles which have batched together and assigned for review. Each Packet has entity references to PacketArticle entities, and each of those has entity references to one or more Review entities. A Review has a reviewer (entity reference to a User), when the review was posted ...

Score: 1
Why is the order/weight of blocks added to region not saved?
cn flag

I have used layout builder to manage display on the default display of a content type.I have not selected "overrides allowed" so that this is the global layout for this content type. I see the "You are editing the layout template for all {{MyType}} content items."

Within one of the sections I am adding 4 blocks to a single region then dragging them into the correct order. However the order or wei ...

Score: 0
hockey2112 avatar
Results from "end date" in date range excluded from Views results
tr flag

I have a view of Commerce orders, and I need to add an exposed filter to filter the orders by date range. I have added two exposed filters for Order: Placed. One filter is "greater than or equal to" for the start date, and the other filter is "less than or equal to" for the end date. I also have Date Popup module installed.

When I choose May 15, 2022 as my start date and May 16, 2022 as my end d ...

Score: 1
Is "event_subscriber" a reserved naming convention for services? Are there guidelines to follow?
cn flag

So I was working on a project today, and an event subscriber we had written the better part of a year ago was determined to no longer be firing. Here is the definition:

services:
  my_module.event_subscriber:
    class: Drupal\my_module\EventSubscriber\XYZFeeds
    tags:
      - { name: event_subscriber }

I went through the normal debugging, and found that the event was not being added to the registry.  ...

Score: 0
Giuseppe avatar
How upload a file\image via json api?
br flag

I'm trying to upload a file or image on a D9 site via json api. The test is namely to upload the user picture on the user entity.

I've been following the documentation or read questions about, but I can't get it working.

The front-end is done with Next.js.

One the test done is the following:

The front-end next calls the next.js api server:

const filename = selectedFile.name;
const fr = new FileReader() ...
Score: 0
Anil Thapa avatar
Unformatted Views mutliple taxonomy terms
cn flag

I apologize if it's an obvious question and I'm fairly new to twig and drupal. I'm trying to get the all the taxonomy term selected on the field field_delivered_on_behalf_of in views-unformatted twig file. It just gets the first term but doesn't get the other terms.

{{ row.content['#row']._entity.field_delivered_on_behalf_of.entity.name.value }} 

I am thinking of loop as well but just couldn't get my hea ...

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.