Latest Drupal related questions

Score: 0
Chanel avatar
Site returns 403
mx flag

This is a head-scratcher. I built a new Drupal 9 site on a RHEL test server with a temporary domain. Everything worked great. I moved it to the production server, again using a temporary domain, and everything worked great. This morning I set up the new Apache conf file on production. The site works fine as portal.yln.info and www.yln.info, but yln.info throws a 403 error (those three domains were ...

Score: 0
Bavramor avatar
Menu items are displayed differently
sg flag

I have a multilingual page with the languages Spanish and English. When I edit the menu items in the backend, my default or original language is English. Now the menu links in this menu are always displayed in the language that is selected as the language path at the top of the browser bar. So I have something like https://stage-mydomaini.de/es/adminbereich/structure/menu/manage/main or https://stage-mydo ...

Score: 0
user3086053 avatar
How to correctly embed a view in a view
th flag

My solution is working fine, but I want to know if this is the correct way? Because when I update an article, I need to clear caches to see the changes.

Can I replace the twig tweak function with an "embed view" for instance and how?

  1. I have a taxonomy term 'categories'
  2. I have a content type 'article'
  3. I have a view

The view has:

A block (shows all taxonomy terms) and a global textfield with:

{{ dru ...
Score: 1
markus avatar
How can I send more than 5 emails per hour?
zm flag

Drupal doesn't allow to send more than 5 emails per hour from a contact form.

Can this value of 5 be changed somewhere? I need to change it for testing.

Score: 1
Manjunath Sharma Konakanchi avatar
How do I filter the result of "Custom Text Field"?
vc flag

I have added a Custom Text field in a view that displays yes / No.

How can I filter the data using exposed filters where custom text field value is only yes / No.

I found that the Custom text field is not added in the SQL query. So, When I am working with the custom views filter I see an error column not found.

Score: 0
Trying to populate one form select with another using Ajax, getting ajax.$form.ajaxSubmit is not a function
cn flag

Building a custom module in Drupal 9.4.5. I need to have the user to select a country from one form select, and that would populate a second (states/provinces) using a form AJAX callback.

screenshot of form selects

It works perfectly when I'm logged in as the admin, but when I log out, I get this error message when I attempt to select a country.

An error occurred while attempting to process /mem?ajax_form=1&_wrapper_fo ...

Score: 1
Mark L avatar
Troubleshooting a Drupal HTTP 500 when there are no error log messages
nr flag

I have reviewed some websites on how to troubleshoot HTTP 500 on a Drupal site and most often I have seen a PHP error by running drush ws in the console, however, I have been running into an oddity and I am not sure where to look to begin troubleshooting as this one doesn't throw HTTP 500.

I am not necessarily looking for someone to troubleshoot this bug specifically, and am not very good at writ ...

Score: 1
Madam Adam avatar
How to properly downgrade an existing Drupal installation to a lower PHP version?
mx flag

I've got a site smoothly running on Drupal 9.4.8 and PHP 8.1. Now I would like to enable APCu in PHP, but my provider unfortunately has installed APCu for PHP 8.0 only. If I simply switch to PHP 8.0, my Drupal installation gives me a an error message:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

Which steps do I have to do, in order to make  ...

Score: 0
Francorce avatar
How to make a Form that retrieve an entity and check if the form input matches with any part of the entity
ht flag

I'm using PHP 7.4 with Drupal 9.4.5.

Hello, i'm new using Drupal programmatically and i'm trying to make a simple form that would allow me to insert an input and tell me if the inserted input exist, if it does, give me the name related to that input.

To make it clearer : I have an entity called inscription which are people with : name, email and a code. When entering the code on my form, i want to get t ...

Score: 2
Why does Drupal >= 9.4.7 not allow including .php files in Twig templates?
do flag

I have been handed a site with an old custom theme purchased from a third party.

After the last drupal update - 9.4.8 - logged in users stopped being able to access the front end of the site. Administration pages were still accessible.

After some digging I found the error was this line in a twig template:

{% include directory ~ '/customize/form.php' %}

It was causing the following error:

Twig\Error\Loa ...
Score: 2
Madam Adam avatar
Adding library charts.js to composer.json
mx flag

I've installed module Moderation Dashboard, now I would like to install charts.js, which is needed by the module, locally by using composer. The readme of the module says:

Add following code inside repositories section in your project's composer.json:

"chart.js": { "type": "package", "package": { "name": "nnnick/chartjs", "version": "v3.9.1", "type": "drupal-library", "dist": { "url": "https://github.com ...
Score: 0
How to forbid acess to a page?
in flag

I want to show a "Access denied" (403) page with message "You are not authorized to access this page." for a given route. This will apply to all users in any case.

How to do it in the simplest way?

Score: 0
Major avatar
I used = in entity query condition, but the actual SQL uses LIKE
in flag

The code is

$entity_query->condition("field_gov.entity.field_name", $time, '=');

The actual sql is

WHERE "paragraph__field_name"."field_name_value" LIKE 'ss' ESCAPE '\\'

I want the actual sql also use =. How can I do?

Score: 0
Oauth/Saml for particular pages
pl flag

I see several modules that allow oauth2/oicd/saml login to the Drupal website (my id provider allows any of the above). I am looking for different setup, I would like to configure the site so that only specific routes are protected by the oauth2/oicd/saml, not using it for general authentication, but specific paths and routes. How can I set this up in Drupal 9? Is there a module that supports this fu ...

Score: 0
Thomas Crawford avatar
Search API Solr sorting with Entityqueue
al flag

i have a Drupal search api view with solr.

I want to use entity queue for sorting the view and setting a specific order of nodes. However this does not work at all.

I have added the relation with entity queue and also added the fields to the sorting part of the view. Nothing seems to change the sorting. Does anyone knows how i can fix this?

enter image description here

enter image description here

enter image description here

Score: 0
Mourad Tlili avatar
How can I attach a newly added paragraph to existing records?
uy flag

While editing a form, I needed to delete some fields and add a new paragraph. The issue here is, the newly added paragraph is not initialized in the edit form and that makes sense because the old data don't have that field so I have to initialize it manually by clicking on "Add Paragraph", then Save otherwise I won't be able to access it programmatically, but I have hundreds of users and I can't do that ...

Score: 0
user3086053 avatar
Bulk update product variations weight
th flag

I've created a module for a custom VBO action. The action can be selected in the view, and the function is executed, but $request is empty and the selected product variation IDs are not available.

class VariationWeightSet extends ViewsBulkOperationsActionBase implements PluginFormInterface {

  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(arr ...
Score: 0
Leolando Tan avatar
Token [current-page:url] is missing the language prefix in multi-language site setup
fr flag

Using Drupal v9.4 and Token v1.10.0, the [current-page:url] doesn't seem to include the language prefix.

The setup is I have two languages: English and Spanish. I created a View where the path is /articles so I am able to access the View page using /en/articles and /en-gb/articles. I then added a Canonical URL using the Metatags module using the said token but it doesn't work.

Score: 0
liquidcms avatar
How to create an Order fee which only applies to certain line items (like an OrderItem fee)?
us flag

I need to create a fee which is only applied to certain items (OrderItem fee) but also has a minimum and maximum that must/can be applied of this fee type to each order (Order fee).

Commerce has base classes for both of these fee types. The benefit of the OrderItemFeeBase is that it provides UI to select which product types this fee is applied to. But using this, I am not able to control min/max  ...

Score: 0
sokratis avatar
Different content, one database
ug flag

Is it possible to have a multi-site installation, where I have different content for each site, but using a single database?

Score: 2
Rubix05 avatar
How can I pull Salesforce objects as users, updating existing accounts when the email address matches?
cn flag

I have a Drupal install that has been live for many years with over 200 thousand users.

We are currently trying to sync our salesforce users with our Drupal users but we only need to do this for certain user roles which would only be about 3000 or so.

I am using Drupal 9, the Salesforce Suit Module v:5.0.0, and I am using the salesforce_pull submodule that is part of that.

My user mapping is working fo ...

Score: 0
mbomb007 avatar
Dynamic webform component select options
nl flag

In Drupal 7, dynamic options for a select widget could be created with hook_webform_select_options_info():

/**
 * Implements hook_webform_select_options_info().
 */
function module_webform_select_options_info() {
  $items = array();
  $items['custom'] = array(
    'title' => t('Custom'),
    'options callback' => 'module_options_function',
  );
  return $items;
}

But this hook isn't in Drupal 9 ...

Score: 1
latikas avatar
How should we configure Config link on custom module?
ru flag

enter image description here

I need to create Config link while enabling module. In routing file, I have mention the path name of config form, but its not directly show in the Configuration page. Below is my routing code.

dm_user_timezone.user_timezone_settings:
path: '/admin/config/usertimezone/usertimezoneconfig'
defaults:
 _form: '\Drupal\dm_user_timezone\Form\UserTimezoneSettingForm'
 _title: 'User timezone page configur ...
Score: 0
Kartagis avatar
How do I restrict content access programmatically?
lu flag

Something is baffling me. I have this view of streams to users. An admin may make a stream to themselves, a specific person or everyone. I also have this code in which a non-admin user may see only the streams made to everyone and that specific user, whereas an admin should be able to see all streams, including the ones made to themselves. I’ve edited my code many times, but no matter what I do, I can ...

Score: -1
How to remove normalize.css that comes from core?
us flag

I tired

libraries-override:
  core/normalize:
    css:
      base:
        assets/vendor/normalize-css/normalize.css: false
        misc/normalize-fixes.css: false

or

libraries-override:
  system/base:
    css:
      component:
        assets/vendor/normalize-css/normalize.css: false
        misc/normalize-fixes.css: false

These lines don't work

This is not a duplicate question because I am asking abou ...

Score: -2
Clicking links to uploaded files shows bytecode
hu flag

This issue just started occurring on our app. We allow users to upload files in our forms and we create links for those files like so;

$f = \Drupal::entityTypeManager()->getStorage('file')->load($file->value);
if ($f) {
  $fileLink = [
    'title' => $f->get('filename')->value,
    'link' => \Drupal::service('file_url_generator')->generateAbsoluteString($f->get('uri')-&gt ...
Score: 0
Form to upload and replace unmanaged file
in flag

I want to make a form where a user can upload a file that will be saved in a predefined path in the private filesystem, replacing whatever was there before.

E.g. the destination file path could be 'private://mymodule/config.yml'.

The file, once uploaded, does not need to be a file entity, it can remain unmanaged. It just holds some global configuration or data.

Ideally there will be some validation  ...

Score: 0
Eluchel avatar
How can I update my staging with with the users from the live site?
so flag

I have a staging site I am about to push live, however I have a bunch of users on the live site that I need to pull over to the staging site before I push it up to the live site. I have google searched everything I can and haven't been able to find an actual answer to the question of whether there is a way to do that or not.

Do any of y'all know how I can pull only my users from my live site and  ...

Score: 0
Views filter "NOT IN" showing all results
kn flag

I have a drupal commerce website.

On my product, i've added a field "stock" which tell if is product is available (custom workflow) which is like the "visibility" field (list of all stores with checkboxes).

I've created a view which list all of my product for a specific store (each store is assign to 1 user).

In my view result, I rewrite the value ot stock. If my store is in the product stock list, I s ...

Score: 0
Jimmyb_1991 avatar
Access Control for Entity List Builder
cn flag

This maybe a very obvious and basic question, but I can't seem to find it asked anywhere else.
I have a custom entity which has its list builder defined in the annotation and not is routing.yml. The list builder class extends Drupal\Core\Entity\EntityListBuilder.

What I need to do is to implement some custom logic around who can access that page, however there is no access() method on that class as I wo ...

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.