Latest Drupal related questions

Score: 0
Wayne Foster avatar
Auto increment value less than max uid on users table
in flag

I'm seeing these errors flooding my log file.

They come from commerce order complete pages - and some registration pages too.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '813' for key 'users.PRIMARY': INSERT INTO "users" ("uuid", "langcode") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_ ...
Score: 0
pierostz avatar
Composer modified installation with changed /web reference in composer.json fails
na flag

Based on this question.

I am running a modified composer installation.

composer create-project --no-install drupal/recommended-project ./

I am changing "web" in the composer.json like so:

{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.o ...
Score: 0
Jaypan avatar
How do I programmatically create a node or entity with an overridden layout?
de flag

I have a content type, page, that has layout builder enabled for the full view mode, with each node able to have its layout overridden.

I need to programmatically create a page node, and customize its layout-builder layout to show the following two blocks in a single-colum (vertically-stacked):

  • field_banner (entity reference field to an entity of type banner)
  • body (node body field)

How can I create ...

Score: 0
twig round function not always working in a Webform
do flag

I have a Webform that makes use of some computed fields.

Here is an example of the computed result:

{% if data.rent_amount and data.rent_period %}
 <span>$
  {{ (data.rent_amount / data.rent_period) *14 |round(2)}}
 </span>
{% else %}
 <span>$0.00</span>
{% endif %}

This works "most" of the time. But sporadically on mobile devices the round(2) function doesn't fire leading to  ...

Score: 0
raresample avatar
401 error when trying to retrieve OAuth authorization code
in flag

I'm building a decoupled Next.js frontend to consume data from Drupal JSON:API on a local site installed with Lando. I want to use the simple_oauth module to allow registered users to edit content on the front end.

My first target is requesting an Authorization Code, so I'm testing the request in Postman and with cURL. Both approaches are consistently giving me 401 "invalid_client" error messag ...

Score: 0
LBRTYCAT avatar
Error with {{ page.highlighted }} while making a copy of Olivero
us flag

I am trying to learn Drupal 9 theming by copying Olivero theme into my themes folder.

I copied web/core/themes/olivero to web/themes/olive and then renamed all file names containing 'olivero' to replace it with 'olive'. Then I replaced all text inside all files from 'olivero' to 'olive'.

This gives me the error:

The website encountered an unexpected error. Please try again later. TypeError: Drupal\Core\R ...

Score: 0
Marwen Amri avatar
simple_oauth refresh token works only one time
sy flag

I use the [simple_oauth][1] module to authenticate the user.

I have generated the first access_token using the grant_type=password.

then I have tried to get a new access_token using my refresh_token received from first request :

POST /oauth/token

grant_type:refresh_token
refresh_token:def50200d3c74fa2e41a886a6ff1...
client_secret:l0r3m1psum

the first time I execute the request it returns the new

Score: 0
quantumized avatar
How to make a Search API Facet to expand the results (the operator is set to "OR" but does not change the results)?
ng flag

We have a Search API index with some Facets to limit the results by "State" and "Category" with another facet to "Include National" and the operator is set to "OR" (the default) which states that it should expand the results.

The intended behaviour is if "National" is checked then also include node tag as such, even if they do not match the other facets. But changing the operator between AND &amp ...

Score: 0
timmyblaze avatar
Customize search results page
do flag

Is there a specific way to customize the search results page in Drupal 10? I would like to change the look of how the results are displayed. I have used Views to create the look how list items but I do not see an option for the search results? For example, how would I turn the search results into a list of bootstrap cards? I would like the list the results as cards with field values showing. I can do so ...

Score: 0
Save multiple taxonomy terms in migration from array of tids
in flag

I'm having some issues with storing multiple taxonomy terms in a field as part of a migration.

I've created a custom plugin get_colors that returns an array of existing tids. A custom process plugin was needed her as the source values don't map cleanly.

pseudofield_colors:
    plugin: get_colors
    source: keywords

I can get a single tid value to work correctly but can't figure out how to iterate thr ...

Score: 0
quantumized avatar
Using views_query_alter() hook to dynamically add a OR "where" to a Search API View?
ng flag

We have a Search API View that we need to dynamically include results to the query that where filtered out.

The use case is that the Search Index View shows a filtered list of node but we have a checkbox to "Include National Listings" where nodes that are marked as "National" should show in the results even if the do not meet the current search or facet filters.

The below code is probably on the rig ...

Score: 0
Chris avatar
How to show content / blocks in views for path component 3, 2 OR 1?
ec flag

The taxonomy contains mostly 3 levels, sometimes two levels only.

Parent
  Child 1
    Grandchild 1
  Child 2

Via path alias, the patterns create URLs like:

/parent/child1/grandchild1
/parent/child2

When I configure my views block with the logic for the grandchild and place this blog into the layout builder of the taxonomy, it's working like a charm. enter image description here

Only when I hit the the URL of the child (not g ...

Score: 0
Mayk RE avatar
trigger('RefreshView') problems with pagination
gg flag

Colleagues, can you please advise: there is a views with enabled ajax and pagination, there is a form on the page (also ajax, but not views), which makes changes to the displayed views values. To update the views with the values after the form's ajax processing, I use $(".view-name").trigger('RefreshView'); Everything works fine, but there's a nuance - pagination, specifically, no matter which page we w ...

Score: 0
Vitaliy K avatar
Deleted context link still exists in admin toolbar menu
tr flag

I have deleted context but in admin toolbar it still showing . On main context admin page context doesn't exists. I have installed/uninstalled module - not helping

How do i remove that link from toolbar menu?

enter image description here

Score: 0
RafaTicArte avatar
Insert Media button in Ckeditor 5 not load with non admin user
ph flag

I use Drupal 9.5.5, CKeditor 5 and BootstrapBarrio theme, but I have also used Claro theme.

I have disabled "Aggregate JavaScript files" and "Aggregate CSS files" option in Performance, Insert Media with Media Library does not load when a user (non admin) edits node.

I get that errors:

Ocurrió un error durante la ejecución de la respuesta Ajax: TypeError: $element.dialog is not a function ajax.js:411:2 ...
Score: 1
Mykyta Miakushka avatar
"migrate:status" freezes on "Try to validate bootstrap phase 0"
sm flag

Drupal community!

I am working on migrating from D7 to D9. Both are located on separate servers. I configured D7 database as db to migrate in my D9 settings.php, like this:

$databases['migrate']['default'] = [
  'database' => 'dbname',
  'username' => 'username',
  'password' => 'password',
  'prefix' => '',
  'host' => 'd7_ip_host',
  'port' => '3306',
  'namespace' => 'Drupal\\Cor ...
Score: 2
Kevin avatar
CKEditor 5 - access PHP plugin configuration from JS plugin?
in flag

I have provided a CKEditor 5 plugin a PHP configuration class. I am able to set and store configuration for the text editor plugin now, but do not know how to access that configuration value(s) from my JS plugin files that create the editor button/logic. How do you do that?

Score: 0
RafaTicArte avatar
CKeditor 5 does not load with Aggregate JavaScript files option
ph flag

I use Drupal 9.5.5, CKeditor 5 and BootstrapBarrio theme.

When I enable "Aggregate JavaScript files" option in Performance, CKeditor does not load when a user (non admin) edits node.

I uninstalled Advanced CSS/JS Aggregation module also.

Any idea?

Thanks.

Score: 1
Martijn avatar
How do I migrate 1000+ nodes iteratively with term hierarchy and links in a CSV file?
US flag

I run for almost 15 years now a Drupal website as a hobby. I had lots of help of the great Drupal commmunity with this. And was able to migrate from drupal 5-6-7 with the modules which were add hand. Now I need to go to Drupal 10. But how?

My site is fully dependent on the weblinks module, and there is no Drupal 10 version of this. I have 1000+ nodes on it.

My thoughts are to migrate the content thr ...

Score: 0
Mariano Banchio avatar
Export product image with Commerce Cart API module
gb flag

I'm usng the "Commerce Cart API" module on my website to build a custom cart js layer. The problem i am facing is the purchased entity has a field_image field and I would like get the url of that images instead of the file id.

The json response of cart?_format=json looks like the following:

    [
  {
    "order_id": 9,
    "uuid": "a4604a10-f956-41e7-87f6-0d745b9345a4",
    "order_number": null,
    " ...
Score: 0
thiokol avatar
How can I display the output of a view with no surrounding templates that can be embedded in an iframe inside another website?
cn flag

I have a user contextual view which is accessed via a URL like:

/user/114/my-view

I want to provide the output of this view in a raw format without any surrounding page HTML so that it can be emdedded in an iframe in any website.

I bascially need to get rid of anything that is produced by the page template.

A similar question can be found here, but it is very old and refers to Drupal 7: https://st ...

Score: 1
ChumKui avatar
Alias listed but cannot be used
mx flag

I am using Drupal 9.x now and using Drush 10.x. I have always used drush aliases to manage my D7 sites as it makes life so much easier with various environments etc.

To test the newer YAML file (Drush for my old D7 uses a php file), I created a single Drush alias for a uat environment. The file, local.site.yml, is located in my ~/.drush/sites directory. When I do a drush sa to check what aliases exist, ...

Score: 0
ymdahi avatar
Auto assign term to node from term field from user
in flag

I have a term field called "Organization" on both Content and User entities.

On the Content entity, the field for Organization is hidden.

For the user, they select a value for Organization.

I'd like to automatically assign a value on a Node to be equal to the value of Organization in the User entity (if available, other leave empty).

There seems to be a number of ways to do this:

  • Rules, ECA, and other  ...
Score: 0
wil_SRQ avatar
Do I need to apply changes in default.settings.php to settings.php?
ec flag

Recent updates to Drupal 7 have included changes in default.settings.php.

Do they need to be incorporated into settings.php manually, or does the code automatically look up in default.settings.php when it can't find something in settings.php? Apologies if this is in the documentation, I couldn't find it.

Score: 0
johnfallen avatar
How can I add workbench_access to a custom content entity?
us flag

I have a custom entity and want to use our current workbench_access scheme to it.

I've google for a long time and can't find and example.

This article says that workbench_access now supports multiple access schemes and maybe I can use that to add access control that way.

Do I write code in hook_install()?

Do I add a specific handler in the @ContentEntityType annotation?

Sorry if this has been cov ...

Score: 1
Orane B. avatar
Hook post update not found
bf flag

I have a problem with the drush updb command which does not find the hook post updates of my custom module. I noticed that the module install saves the module's name string here in database, table "key_value", in BLOB file.

Table key_value : enter image description here BLOB file :

enter image description here

My post update in mymodule.post_update.php :

enter image description here

As it is present in the database, the command seems to consider that the hooks are executed when not. Is ...

Score: 0
pierostz avatar
Run composer installed drupal from root (/) and not /web directory
na flag

How do I run a composer-installed Drupal site from / instead of /web?

The default install with composer create-project drupal/recommended-project ./ will install Drupal in the /web directory. So when the site is uploaded to a host, the actual website root will be www.example.com/web. In most cases, the desired path to run the website is www.example.com/.

I have managed to do this, like this. And actuall ...

Score: 0
raresample avatar
401 error when trying to retrieve OAuth access token
in flag

I'm trying to configure simple_oauth to use with local Lando install of a Drupal 9 site with decoupled React frontend.

I followed the instructions at https://drupalize.me/tutorial/install-and-configure-simple-oauth?p=3003 and generated the necessary RSA keys in the terminal:

$ openssl genrsa -out private.key 2048
$ openssl rsa -in private.key -pubout -out public.key

...placing the keys into /drup ...

Score: 0
sidgrafix avatar
Form field states with media fields that use media library widget and conditionally displaying visibility based on other media fields
rw flag

I am trying to get some media fields to hide/show conditionally using $form fields #states API, based on other media fields (all the media fields are using the "Media Library" widget in form display.) I'm working with a node/add and edit for a content type in Drupal 9.5.4 and using hook_form_alter() to manage the states.

There are 3 media fields in total - if one has media added the other two sho ...

Score: 0
raresample avatar
Errors when providing or generating keys for Simple OAuth module
in flag

I'm trying to configure simple_oauth to use with local Lando install of a Drupal 9 site with decoupled React frontend.

I've tried to manually generate the keys in the terminal:

$ openssl genrsa -out private.key 2048
$ openssl rsa -in private.key -pubout -out public.key

...placing the keys into a sibling directory of /web/ and /vendor/ called /keys/.

It throws these error messages:

"The Public Key fil ...

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.