Latest Drupal related questions

Score: 0
Ahmet Yavuz Demir avatar
After drush archive-restore of a backup tar in a new machine, how to configure apache2?
sh flag

I have a up and running Drupal 7 site in a Centos 6 machine and Drush 6.2.0 is being used. I need to migrate it to Ubuntu 22.04. I used drush archive-dump to create a backup tar. Then I moved it Ubuntu 22.04. I used drush archive-restore to restore the sites in the new machine. I successfully migrated public_html folder and mysql database.

As I understand from the installation guides, next step i ...

Score: 0
FrankDK avatar
Custom menu that handles content type creation
cz flag

I'm a Drupal 9 newbie, and right now I'm on steep side of the learning curve. I apologize if my question is a bit messy and long. Please bear with me.

I'm on Drupal 9.4.8 with a Bootstap 5 theme.

I'm planning on making a custom dynamic menu in a department page that handles additional content ( hope that makes sense... )

I have a dynamic department page which is created via my DepartmentsController sho ...

Score: 1
ImagineSystem7 avatar
How to display a user’s published content on their account?
mn flag

Does anyone know how to display every article (or content type) a user has published on their "my account" view? To clarify, I only want it to display that specific user's published content so that all users can click on a user and then see all of that particular user's published content.

What I currently have set up so far is my account/user's view page setup and displays the user's username and ...

Score: 1
Inbal Jona avatar
Hiding machine name from a form temporarily only during validation
ph flag

I’m looking for a solution to hide machine_name from a form temporarily (only during validation) and restore it afterward.

When the form has validation with errors the machine name appears (with a different label like: "Internal name"). I need to hide the machine name while validation has errors. And also force the user to change the name of the source to avoid errors.

My solution (that still not wor ...

Score: 0
Abhilesh Sharma avatar
How can I show child categories in the parent category page?
ch flag

I have created a new vocabulary with some extra fields and these taxonomy terms.

  • Parent 1

    • Child 1.1
    • Child 1.2
    • Child 1.3
  • Parent 2

    • Child 2.1
    • Child 2.2
    • Child 2.3
  • Parent 3

  • Parent 4

  • Parent 5

In the parent category page, how can I show child categories with images or other custom fields?

Score: 0
sudhan avatar
AliasManagerInterface -deprecated Drupal\Core\Path\AliasManagerInterface
us flag

Error:

The website encountered an unexpected error. Please try again later. TypeError: Argument passed to Drupal{module name}\Theme{class name}::__construct() must implement interface Drupal\path_alias\AliasManagerInterface, instance of Drupal\Core\Path\AliasManager

Getting error in the construct method, please suggest a solution to rectify the error.

Try to modify the "AliasManagerInterface" as ...

Score: 0
Noah Bailey avatar
Issues updating opigno_lms from 2.16.0 -> 2.29.0 -> 3.x using composer
fo flag

Having an issue with updating an old Opigno server from 2.16 to 3.0 via 2.29. For those unfamiliar, it's a distribution of Drupal that has some extra features for lessons, courses, etc.

When performing the update, the tool fails with "Your requirements could not be resolved to an installable set of packages.", indicating some sort of package conflict or dependency issue.

I've followed the instructio ...

Score: 1
Stéphane JAULIN avatar
How do I force the language prefix to the current langcode on node with "Not specified" language?
us flag

I have a multilingual site whose default language is Italian. Some of the content has no language defined.

The problem occurs when I browse the site in English. All the links are displayed with the /en prefix, except the links to the untranslated nodes.
In views, the links that are displayed on those nodes don't have a language prefix. As a result, once you arrive on those nodes, the whole site is in t ...

Score: 0
How to get route inside RequestEvent
ru flag

I need to redirect all existing links targeting a few hand-picked nodes to an external domain. I created an EventSubscriber listening to RequestEvents

my.services.yml

services:
  my.request_subscriber:
    class: Drupal\my\EventSubscriber\EventSubscriber
    arguments: ['@current_route_match', '@redirect.checker']
    tags:
      - { name: event_subscriber }

EventSubscriber.php

/* trimmed constructo ...
Score: 0
MXT avatar
How to create a common template suggestion for all fields contained in a field group?
ro flag
MXT

Using field_group module, I grouped some fields in a field group (e.g. group_side_box as field group machine name)

How can I get a field template suggestion common to all fields belonging to that group?

So in addition to usual field template suggestions:

* field--node--field-article-language--article.html.twig
* field--node--field-article-language.html.twig
* field--node--article.html.twig
* field--fi ...
Score: 1
liquidcms avatar
How to pass paragraph id from layout builder to view?
us flag

I have asked this question before but in a different, more convoluted context. This is a simpler example.

I have a paragraph type which I use Layout Builder to define it's layout. In that layout I have a View (paragraph) used to display content from that paragraph. If I add a contextual filter for Paragraph ID to my View and in Views preview I enter a PID, the View displays the correct results. B ...

Score: 0
Free Radical avatar
How to add content to the form display of a content type from the GUI?
kz flag

I am constructing a form for a new content type (entity) that implements a survey or questionnaire content type. This fields of this content type is added using the GUI. Each field consists of:

  • A question.
  • A widget to accept the answer that is typed by the user taking the survey.
  • A help text.

All this is fine. I want to add additional content to the form that is seen by the user, viz:

  • A heading  ...
Score: 0
Aldi Alhafidzi avatar
user_login_finalize only works when the user has admin roles
cn flag

i create custom login form in drupal 9 using user_login_finalize function. But this function only work when user has admin roles... i dont know why. This is my code :..

{
    if (isset($_POST['email']) && isset($_POST['password'])) {
        date_default_timezone_set("Asia/Jakarta");
        session_start();
        $session = new Session();

        $count_error = 0;
        $user = user_l ...
Score: -3
ACanadianCoder avatar
I'm not quite sure what this error is but it's breaking my site
br flag

Can anyone help me in discovering what is wrong and what needs to be fixed? I did a bunch of updates and now certain portions of my site don't work. I get the following error:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 132 of core/lib/Drupal ...
Score: 1
Dylan Spencer James avatar
How to exclude a field from the SOLR search index for a specific content type
no flag

I would like to exclude all body fields from the search index for a specific content type.

Reason: We have an Author content type with a bio in the Body field. However, for searches, we only want the author name to be indexed. We want the body field indexed for all other content.

Score: 2
nstCactus avatar
How do you override a module's template from another module?
ph flag

I'm trying to override an email template of the webform module. The project is headless so we don't have a custom theme, and we'd like to stick with the Adminimal contrib theme. However, we do have a custom module named app in web/modules/app.

Here are the default template suggestions shown in the email source:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'webform_email_html' -->
<!-- FIL ...
Score: 0
Fabrice Lefloch avatar
Update viewport value
gr flag

maybe it's a stupid question but I couldn't find any appropriate answer to this question. I have a website with Drupal 9.4.8 I need to change the default viewport meta, but I couldn't find a way to do it. I have the Metatag module (which I use to configure my open graph tags) but I can't find any field where I could update the viewport value. I also read that I need to add this function in a .theme file ...

Score: 0
Riley Lutz avatar
Webform javascript CSS selectors with table
jm flag

I'm currently trying to add javascript via the settings tab for a webform that is supposed to dynamically update the displayed totals at the bottom of the webform page for the user.

A part of this involves me targeting a custom webform composite I created myself for this webform so I can hook onto an event that runs every time a value within this composite element changes.

The composite element look ...

Score: -1
alfred avatar
How to prevent search engines from indexing all nodes of a certain content type?
ro flag

How to prevent search engines from indexing all nodes of a certain content type?

The nodes of this certain content type should be published, but just not indexed by search engines.

Since content types don't allow a specific URL structure, I can't use robots.txt for that sake.

Score: -1
menos avatar
How to embed content from one place inside two or more nodes?
vi flag

There is some content (a list of data) which I need to embed/call inside the main content area of two or more nodes.

Calling data from location A inside location B and C or more.

Something similar to an "include" in PHP.

So, if any change is needed to be done to the embedded content, it would be done in one place only and effect all places in which it is embedded.

The content I need to embed woul ...

Score: 0
FraMan avatar
Pre-flag facets when searching products
cf flag

I created a site with Drupal Commerce and I use search api (fulltext) and facets to search for products.

The search works very well and also facets, but I would like to know if there is a way to have some filters already applied via facets when a user searches for a product.

I give an example. I have a text field that indicates if the product is "available immediately", "available in a week" or "not ...

Score: 1
alfred avatar
How to show the slogan in Olivero?
ro flag

I have added a slogan in Olivero but it doesn't appear.

Only the (textual) web site name appears.

I went to edit the Site Branding block and under "Toggle branding elements" I have all three elements check-marked (Logo, Site Name and Site Slogan).

Maybe Olivero just don't support slogans, if so, what can be do about that?

Score: 1
How can I control node access based on entity reference to multiple users
pe flag

I have multiple uses for this functionality now but mainly for a private message system.

What I want to do:

  • Configure a content type with an entity reference to users
  • Create nodes of that type and select multiple users using the entity reference field
  • Limit visibility of each node of that type to the users selected in that field

I believe there was a module for this in D7, though I can't find it now.  ...

Score: 0
Kirkland avatar
What hook to use to fire a JS event when a layout is used?
cn flag

I inherited a Drupal site. I'm a Drupal noob. There are lots of things that don't seem to be in use, but I want to be certain before I delete them. Right now I'm looking at dozens of layouts that are not activated, but I know for certain some of them are used on legacy pages. I'm planning to fire a Google Analytics event with the URL and the name of the layout its using, so I can see what layouts ar ...

Score: 0
liquidcms avatar
How to set widget for a field on a custom form?
us flag

How do I set the widget to be used for a field on a custom form?

I am surprised I haven't been able to find something covering this. Sort of expected it to be something like:

$form['interest'] = [
  '#type' => 'checkbox',
  '#title' => t('Are you interested?'),
  '#widget' => 'my_custom_boolean_widget',
]

But nothing in the FormAPI regarding anything to do with widgets.

Score: 1
leducvin avatar
Migrating from D7 / MySQL 5.6 to D9 / MySQL 8
cm flag

I've read the documentation of upgrading (migrating) from D7 to D9, but didn't see anything about how to handle changing MySQL versions in the process.

My D7 instance is on MySQL 5.6, which is unsupported in D9. Can I use the process described in the official docs linked above, or do I have to take any special actions with respect to the change in MySQL versions?

Note: from the MySQL docs, the reco ...

Score: 0
sidgrafix avatar
Remove settings no-longer present in custom modules config form from drupalSettings
rw flag

Hello Drupal Code Land,

I have created a custom admin form in a custom module as a class extending ConfigFormBase. I use this form as an admin config form to set pricing options for different variables used with a custom content type (called estimates) where the form settings are used having been passed in from drupalSettings and are used in a js file containing several custom Drupal.behaviors to ...

Score: 0
Jimmyb_1991 avatar
Convert a custom entity from RevisionableContentEntityBase to EditorialContentEntityBase in an update hook?
cn flag

I have a custom entity that was generated via the drush command. This created it as an extension of RevisionableContentEntityBase. I now have a need to add moderation states to the entity, but this is seemingly only supported via EditorialContentEntityBase.

Is there a way I can install the missing fields etc in an update hook?

The only way I have managed this locally is by reinstalling the module, and t ...

Score: 1
How to programmatically set a checkbox value of an user account which field is not in /people/accounts/fields
us flag

I need to set a checkbox which has an unknown field (machine) name in the user account. the checkboxes are in the user account /user/?/edit Screenshot of subscription edit checkboxes

but they doesn't appear as fields in people/accounts/fields and are provided by the
DANSE Content Moderation Module.

I need to update them through a twig template with a custom form controller which works fine, but i cannot find the right way to update the field. I' ...

Score: 0
stefgosselin avatar
Composer not respecting constraint defined in composer.json
cn flag

I have a build, with the following constraint on drupal/core, for some reason the constraint is not respected.

Upon running composer install this comes up:

 - Downloading drupal/core (9.5.0-rc1)

Composer show -i drupal/core:

name     : drupal/core
descrip. : Drupal is an open source content management platform powering millions of websites and applications.
keywords :
versions : * 9.5.0-rc1

I seriou ...

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.