Latest Drupal related questions

Score: 0
Gunnar Vestergaard avatar
The quick-start script in Drupal fails
de flag

I am trying to install Drupal v 9.2.9 on my web server. I was informed by core/INSTALL.txt that I could run the script

php core/scripts/drupal quick-start

It stops the installation prematurely with an error message:

In RouteProvider.php line 206:
Route "user.reset" does not exist.

How do I solve this? I have not set up a database yet. The web server has MySQL and PostgreSQL installed.

Score: 0
bigboy avatar
Update node and all translations programmatically
gu flag

I need to add tags as taxonomy terms to already created nodes in 7 languages.

If I do this:

$node = Node::load($nid);
$node->set('field_tags', getTerms($terms));
$node->save();

Just default node in English is updated, however, all terms are created in all languages.

getTerms() - is my own function, which is getting term ids and creating them if they don't exist.

I need to update all node transla ...

Score: 0
Run php code on text field in variation possible?
cn flag

Is it possible - anyone know how - to run php code on a commerce 2 variations created field to check the data in that field maybe using Ajax to make the field typingsensitive in the checkout?? I read through https://www.drupal.org/project/commerce/issues/3103537 but but the code there. The field would be used to verify an imei or Vin number before the purchase can be made. ( I have code to count k ...

Score: 0
Export data with one thousand values in contextual filter
fr flag

I have a view (views data export) that I need to pass approximately 1000 values for a the contextual filter. I need to get the view results for certain 1000 node ids.

Via the GUI it allows me only a few values as parameters. How could I have a CSV with the fields I have added to the view of the nodes given as a contextual filter all these values?

I have tried to export the view, edit it and manually ...

Score: 0
Baud avatar
How to get the revision of a paragraph
sa flag

I have a code which is running in hook_node_update. This code grab the revision of the saved node and compare the values of the fields between current node and its revision to generate some kind of historic log (what is deleted/updated/added).

This is working very well except for the paragraph field... When my code is trying to get the revision of a paragraph (recursively), I got each time the same para ...

Score: 3
Baud avatar
How to not split select list by content type
sa flag

This is about the regular select widget that you can choose in the Manage form display page.

If this widget is linked to an entity_reference field allowing several bundles to be selected; then you end up with an #options populated as follow:

_none -> "None"
Bundle label 1 ->
  id1 -> "label of ID 1"
  id3 -> "label of ID 3"
  id4 -> "label of ID 4"
Bundle label 1 ->
  id5 -> "la ...
Score: 6
How can I remove default image from image fields?
ru flag

I need to create an image field with a default value, which must also be nullable on single content entities. Contrary to text fields or entity reference fields, I was unable to remove this default value on single content entities.

E.g. I can create a text field with default value "Lorem ipsum". On node creation, the field is prefilled with that text, but I can also delete that text and the field ...

Score: 2
Baud avatar
How to alter the view behind a select widget in a regular node edit form
sa flag

I have an entity_reference field in a content type: field_node_ref

In the field definition, it can reference all the nodes of a given type.

The widget used for this field is a select widget

Depending the context, in the node edit form, I would like to use different views to populate the #options of the select widget.

Ex:

Context A --> View A will be used

Context B --> View B will be used

The cont ...

Score: 0
Display a pager on the top and bottom of view pages but only on the bottom of view blocks
pe flag

For a project running on Drupal 9.2.9, I want pagers on the top and bottom of view pages. I have it working on pages by an edit to a custom views-view.html.twig in the theme (using the full pager option in the Views display). Unfortunately, this resulted in double pagers on blocks using minipager also.

I think I need a little conditional logic in the views-view.html.twig template to check for if …  ...

Score: 0
view and context variables does not get passed on VBO custom execute action
in flag

I have created a custom VBO action and below is my code for the customaction.php. The action is getting created perfectly fine, however the $view and $context variables are not getting passed through. They are all getting null. Below is the custom action code:

    namespace Drupal\mymod\Plugin\Action;
    
    use Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase;
    
    /**
      ...
Score: 0
How can I make certain fields of my block implementation translatable?
vn flag

I've created a simple module, which extends BlockBase to provide a custom block.

This block class has a few fields (e.g., "Header"), which I would like to be translatable.

How can I accomplish this? The Drupal docs have a section titled "Make your block translatable", but it hasn't actually been written yet.

I've found some posts which suggest that my module needs a .schema.yml file – but I'm n ...

Score: 0
jfc avatar
Is there a way to duplicate existing fields instead of manually creating new ones?
us flag
jfc

I am using Drupal 9 and I have a template which will require 40 text fields and 20 image fields.

They are meant to display 20 individual products, so they are all similar. The display would be something like this -

Product Title 1 Product Thumbnail 1 Product Subtitle 1

Product Title 2 Product Thumbnail 2 Product Subtitle 2

And so on for 20 products.

To add this field manually will take a very long  ...

Score: 1
Adding an "Accept Terms" checkbox on User Registration form
in flag

I need to add an "Accept terms and conditions" checkbox onto a user registration form. What is the best way to do this?

Also, it seems odd to me that there is no easy way to use radio buttons nor checkboxes on the User Registration form at admin/config/people/accounts/fields. Select lists are awkward, especially for multi-select lists on a mobile device.

Is there a way to output the list fields as ...

Score: 0
Amine avatar
custom module form radios fields & ajax problem
us flag

I have a custom form, that iI develop on a custom module to get some fields from a content type with an entity reference.

All is good, I can get all information, and I can save the chosen value on a field of content type.

My problem is: why is it that the first input radio doesn't save and show me the max, but I have 0 on the field like a value.

My code to create the field of form:

'#type' =&gt ...
Score: 0
How to make the private image accessible with image style?
kr flag

I have a private image with this URL.

http://mystite.com/system/files/images/IMG_0371_24.jpg/IMG_0371_24.jpg

An image style is created for the above image on location

http://mysite.com/system/files/styles/square/private/images/IMG_0371_24.jpg/IMG_0371_24.jpg

The problem is when I display the original image, it works fine. But when I display the image with style, the image is not displaying and in th ...

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.