Latest Drupal related questions

Score: 2
trazom avatar
Do I need the trusted host setting?
cn flag

Do I need the trusted host setting for a Drupal 7 site? If so how do I configure it?

I noticed that Backdrop CMS has it in their settings file.

Score: -2
latikas avatar
How can I replace the Home link with an image?
ru flag

I want to replace the Home link shown in breadcrumbs with an icon.

screenshot

screenshot

How can I achieve this?

Score: 1
Kaka Awira avatar
How to solve this error "Class \Drupal\simple_sitemap\Controller\SimpleSitemapController does not exist"
tr flag

I got this error which is kind of surprising to me since I don't have it on my local environment. What I did is that I compressed the project directory and uploaded it to my cpanel file manager and then extract it. I then imported the sql file to phpmyadmin and made the credential match the ones on my production server.

When I open my site, it was working on the front page and other pages creat ...

Score: 2
Missing bundle for entity type node after upgrading
ph flag

I recently upgraded a local sandbox to Drupal core 9.2.4. While testing things out, I got an error when trying to add a new article content from /node/add/article.

The log shows the following message.

Drupal\Core\Entity\EntityStorageException: Missing bundle for entity type node in Drupal\Core\Entity\ContentEntityStorageBase->doCreate() (line 97 of /var/www/drupal9sandbox/docroot/core/lib/Drup ...

Score: 5
How to make a checkbox read-only/disabled from list of user entity references
cn flag

In my Content type, I add a field Reference: User with unlimited values, Reference method from a view of user managers, and widget checkboxes.

Basically when a user manager edit the node, he can only check the box with his own name. The other checkboxes are set to disabled. The node will be published if all managers check the box.

I've tried creating form_alter function like below

function mymodul ...
Score: 0
Sam Ng avatar
Custom Migration Plugin MySQL Error
ck flag

I've run into the following error when running the command drush migrate-import custom_spotlight where custom_spotlight is the name of the plugin. I've been following along with this guide: https://www.metaltoad.com/blog/drupal-8-migrations-part-4-migrating-nodes-drupal-7 but I'm not exactly sure what went wrong here. It seems when the placeholder :nid is substituted with a value, there are quotes inserte ...

Score: 0
mogio avatar
Sql Migrate - working example
cn flag

Ok I just spend 8 hours with the migration module. I was not able to find just one working example for the migration of sql data. Even Drupal's own documentation has the state "outdated".

I am trying to import just titles - so that should be pretty straightforward. Unfortunately, I do not even get an error when trying to import the configuration nor by the source plugin.

test_migrate_er.info.yml - (the m ...

Score: 0
shelane avatar
How do I add a media item with a custom form?
cn flag

I have a custom form that currently uses a managed file field and then stores the value in config. However, if there is ever an issue, the user must remove and upload a new file. I would like them just to be able to select an image from the media library/browser. The selected media item would then be displayed in a template. What type of field can I use to do this?

It seems I missed this question with alm ...

Score: -1
Web Form Submission customizations of Email Handler
ng flag

The webform provides the [webform_submission:values] but when sent through emails, the layout is not very readable. All values are not separated for readablitity where I can use paragraph tags to separate it.
I am assuming something like the below would be the way to do this but I cant find the right syntax to make it work.

I would like something like that I can wrap html around to create readability.  ...

Score: -1
vyshnavi avatar
drupal custom callback in node edit form is not firing
eg flag

i am fairly new to drupal , i have custom button added to one the content type edit page , when i click on that button i want to call a function but it seems like it is not calling function when i see the console i see drupa ajax error coming whenever i click the button . please let me know what i am doing wrong here .

function mymodule_form_node_program_edit_form_alter(&$form, FormStateInterf ...
Score: 1
berramou avatar
How to invalidate Breadcrumbs cache for child nodes on graphQl
gb flag

I have for example Node A with alias node-a and Node B with alias node-a/node-b so on my Node B i have this breadcrumb Home > Node A > Node B

GraphQl result:

"breadcrumb": [
                {
                    "text": "Home",
                    "url": {
                        "path": "/",
                        "routed": true
                    }
                },
                {
        ...
Score: 0
Amine avatar
How to get the field data
us flag

Hi i'm using entityreference, i hava an content type"test" that contain a field that refer to categorie and this categorie contain a field_theme also referenced to another content type theme_test. On Theme_test i have a field entityreference that refer to Criter and this last is saved on Test Finally on an other field let's name it recap.

array(19) {
  ["#theme"]=>
  string(5) "field"
  ["# ...
Score: 1
Серёжа Попырин avatar
Send an AJAX response and rebuild a form in a single AJAX callback
us flag

I need to execute multiple AJAXCommands and rebuild form in one AJAXCallback function, but the documentation says the AJAXCallback function should return AjaxResponse OR FormElement.

Using ReplaceCommand to replace an element is difficult because after the AjaxCallback SubmitButton should be searched, and its #Submit function.

How can I do this?

Score: 2
How to set a validation constraint for base fields like the taxonomy term name?
cn flag

I'm having trouble setting a validation constraint on the name of the taxonomy term.

function MYMODULE_entity_bundle_field_info_alter(&$fields, $entity_type, $bundle) {
  if ($entity_type->id() === 'taxonomy_term' && $bundle === 'my_taxonomy_type') {
    kint($fields['name']);
    if (isset($fields['name'])) {
      kint('found name');
    }
  }
}

When I rebuild the cache with drush,

Score: 4
How to make taxonomy term names unique per user?
cn flag

I have a taxonomy vocabulary, Groups.

Requirements

  • Different users can create groups with the same name. (User A can make an apples group, and User B can also make an apples group.)
  • The same user cannot make two groups with the same name (User A cannot make two apples groups.)

How can I implement this?

D8/9 offers a field constraint as explained in this answer and this blog post, but this makes a field  ...

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.