Latest Drupal related questions

Score: 0
DStrider avatar
Where to implement CSS previously implemented by CSS_editor now deprecated
in flag

Theme css in useViews with tables have a Flag that changes from Pending to Complete when the row is completed. The background of the entire row changes color depending upon the word.

Working css_editor code (theme settings custom CSS enabled):

tr.pending td { color: red; }
tr.Complete td { background-color: #66ff99; }

After uninstalling the deprecated css_editor module, I have no idea where to put the above code. Al ...

Score: 1
Akbar Bakhshi avatar
Problem with Adding new fields with Ajax call to a custom form
vu flag

I have a simple form where I am trying to add a couple of fields to it when the user clicks a button using an ajax callback. Here is what I have:

public function buildForm($form, FormStateInterface $form_state)
  {

    $form['add_fields'] = [
      '#type' => 'button',
      '#value' => 'Add new fields',
      '#ajax' => [
        'callback' => [$this, 'ajax_callback'],
        'disabl ...
Score: 2
EvilArgest avatar
How to get webform url object, if I have webform machine name and webform path
uz flag

I have webform path and webform machine name, how can I get url object of this webform?

Score: 2
Christopher Lambert avatar
Testing equality of two variables - one is entity reference
mk flag

I'm new to Drupal theming and twig, so apologies for asking a simple question, but it's driving me crazy. I can't find the solution.

I'm trying to test the equality of field from a Custom content type - field_program_level - that's an Entity reference type. field_program_level has two possible values : G and UG.

I've tried everything I know and my code doesn't work. My current code is:

{% set yy = conte ...
Score: 1
Going from 9.5.1 to 10.0.1 keep getting same error message regarding Twig
cn flag

I've tried going to 10.0.1 using Composer and then tried updating to 10.0.1 and get the same error message....

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

Error: Class "Twig_Extension" not found in include() (line 12 of /home/customer/www/wiulibraries.org/public_html/video1/modules/entity_embed/src/Twig/EntityEmbedTwigExtension.php).

include() (Line: 571) Composer\Autoload\incl ...

Score: 1
Quetzcodecoatl avatar
Trying to insert a line break inside a table header array
tw flag

So I'm programming a module in Drupal that contains several custom forms, one of which also has a table.

One section of the code of the table mentioned above looks like this:

$form['completion_' . $week] = array(
   '#type' => 'table',
   '#title' => 'Completion Week',
   '#header' => array(' ', 'Header 1', 'Header 2', 'Header 3'),             
);

The forms and the tables themselves work correct ...

Score: 1
amol avatar
How to retrieve all taxonomy term using json api
th flag

I want to retrieve all taxonomy term name using json api.

I have tried:

http://local-tes/jsonapi/taxonomy_term/specialties

but its only return 50 values, I want to fetch all taxonomy terms values.

Score: 0
Rob Holmes avatar
Retrieve the name of the menu that a menu link is in
cn flag

Given the code below i can get the menu link of the current page. What id like to know is how to determine what menu that link resides in.

  $current_path = \Drupal::service('path.current')->getPath();
      $params = Url::fromUri("internal:" . $current_path)->getRouteParameters();
      $entity_type = key($params);
      $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     ...
Score: 0
How can I to make the CKEditor 5 balloon editor inline editor work?
cn flag

Drupal 10 comes with CKEditor 5, which allows for inline editing, including a balloon editor.

It doesn't seem there is a setting in Drupal 10 for that yet. How can I activate the balloon editor?

Score: 0
tonytheferg avatar
How to display a shipment method as an order item row in csv or table view
cn flag

I am creating a csv order view with a relationship to pull in referenced order items, and it gives a row for each order item as expected :

Order 1, item 1 title, item price,
Order 1, item 2 title, item price,
Order 2, item 1 title, item price,
Order 2, item 2 title, item price,
Order 2, item 3 title, item price,

I would also like to add only one extra row for every unique order that contains the refer ...

Score: 1
How can I set a Rules action to unpublish a comment when a specific flag is set?
pe flag

I'm attempting to create a flag that will unpublish a comment when the flag is set on that comment.

I'm attempting to use Rules, Flag, and Rules Flag to achieve this.

The comment type is default 'comment' I'm calling the flag 'unpublish_publish' The flag is global

Where I get stuck is on the Actions portion of the rule creation. For the trigger event I have: After flagging a comment of type Default com ...

Score: 1
Juan Carlos Osorio avatar
How do I change the "secure" and "httpOnly" attributes of the cookies provided by the EU Cookie Compliance module?
ec flag

I am using the eu cookie compliance module in Drupal 9 and I need to change the "secure" and "httpOnly" values of the cookies, as I am getting a vulnerability error "CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute". I have tested from the settings.php using the following code:

ini_set('session.cookie_secure', 1);

However it didn't work, I also tried with some modules but it didn' ...

Score: 0
How to change media image private to media image public, just for a specific filemime, and update the url?
eg flag

Using Drupal 9.4. The Media File system is set to Private The Drupal default media type Image is set to private. It now contains hundreds of images. We want to switch only this media type from private to public. We want to keep PDF files private, these are in the Drupal default media type Document.

My process is this. Copy all the images from the private folder over to the public folder, keeping  ...

Score: 0
Boussetta moez avatar
Custom sorting using a MySQL statement instead of simple field
jp flag

I'm using a view to list products from db index. I want to implement a custom sorting (my goal is to sort by current taxonomy term page, products having a specific node field field_MY_FIELD_NAME = CURRENT_TID, showing up first)

First using hook_views_data_alter I override the sort of an indexed field that I have chosen as a sort criteria inside the view

function MODULE_views_data_alter(array &$data) ...
Score: 0
Michiel avatar
How to render fields with ->view() in a render array table?
jo flag

I am building a table in my build function of a block and want to render formatted field values or entities with the ->view(); method in a cell of my table.

As described here: https://www.computerminds.co.uk/articles/rendering-drupal-9-fields-right-way

I have a value like this:

$cell_value = $entity->field_name->view();

It outputs a render array. But when I put it in the table like this. Noth ...

Score: 1
ice70 avatar
RewriteBase and Administer software updates permission not working
cn flag

User 1 is unable to run /update.php, with the error: In order to run update.php you need to either have "Administer software updates" permission or have set $settings['update_free_access'] in your settings.php.

If I set $settings['update_free_access'] to true, I can run the update.

I get this even on a default installation [Drupal 9.4.8]. It looks like it is down to the Apache configuration:

DocumentRo ...

Score: 0
Ahmed Ashraf avatar
How to access block contents in run within hook_form_alter?
fr flag

I am using Drupal 9 and I need to get the block content within hook_form_alter implementation, I tried these lines:

$bid = 'consumerorganizationselection';
$block = \Drupal::entityTypeManager()->getStorage('block')->load($bid);

but this ended up returning the block configuration not the content. enter image description here

Is there any approach to get that block content in Drupal 9?

I tried the solution of the duplicate que ...

Score: 1
Avoid group of revisions history view duplication
us flag

My taxonomy View lists all revisions grouping by different columns, by adding revision fields for each value, and get the filter "published" removed. The only filter is: city name (not null).

For example:

| London | Roma |

| value 1 | value 1 |

| value 2 | value 2 |

As you can tell, people can add different city data by making new revision of the taxonomy. It wo ...

Score: 0
How to make an entity reference field only load a rendered entity, when clicking on it? (ajax load on click)
cn flag

I want to mimic a zettelkasten system, by starting in a very simple way:

An entity of type 'Note' includes a body and an entity reference field, that can reference another note (of the same entity type) as fully rendered embedded entity.

I like to make the viewed note only display the entity reference field as link, but when I click on it the referenced link must turn into a fully rendered entity. ...

Score: 0
Tomáš Bažant avatar
How do I configure sites.php for a multi-site with fixed IP and subdir?
de flag

I have just installed clean minimal Drupal 9, created a sites/sites.php with the following line

$sites['10.0.0.133.drupal.web.foo-bar'] = 'foo-bar.com';

and the following subdir sites/foo-bar.com with settings.php that includes the correct database settings. After entering http://10.0.0.133/drupal/web/foo-bar into the browser, the default site respond which means the site alias has not been recogni ...

Score: 0
How to limit the depth of embedded referenced entities
cn flag

Using Drupal 9 or 10 Using a node type Page with one entity reference field, which is displayed as rendered entity, displaying the same Page content type.

When viewing a page, how do I prevent the page from having endless nested pages in it, leading to infinite loading? I like to limit the nesting to 4 levels deep.

Score: 0
Kurucz István avatar
Logged in user data, after logout
US flag

I need the ID of the logged in user, after logging out. I tried to use a session variable, but all data is lost on exit. Is there any method to use, other than the query parameter?

┌──────────────┐                        ┌──────────────┐
│              │                        │              │
│  Page        │       ┌─â ...
Score: 0
0711master avatar
Views: How to filter content by taxonomy terms that are not selected?
cn flag

I have a view of a specific content type that can be filtered by two different taxonomies A and B. Some nodes that have the taxonomy term A1 also have the term B5. Now when I filter only by the term A2 I also want all the nodes to be listed that have both the term A1 AND B5, irrespective if B5 is selected or not. Is there a possibility to do that?

Score: 1
Jennifer avatar
Custom event from existing event
cn flag

I've been reading for days, trying several examples but I'm just not getting it.

I have the Rules module as well as the H5P module. I'm attempting to create a Rules event from the existing H5PFinished event (which may or may not be the way to go about this).

Their function constructs an array of five fields, which then update in the GDB.

// which fields to update
$fields = [
  'content_id' =>  ...
Score: 0
Add js library to custom ckeditor4 plugin
pt flag

How can an external JS library be integrated into Drupal for use within a custom Ckeditor4 plugin?

My custom plugin needs to set a javascript cookie each time I click on the plugin icon and unset when I close the plugin dialog.

I attempted to use JQuery which didn't work and when I googled the issue, I found a post saying the jquery-cookie is being replaced with js-cookie.

I attempted to install js-coo ...

Score: 0
Vikram8888 avatar
How to change date format of exposed filter input value?
in flag

By default view exposed filter ,filtering the data in such way. http://mydomain.docksal.site/events?combine=&field_event_categories_target_id=All&field_start_date_time_value=&field_start_date_and_time_value=2023-01-07. When we inputs the date field in such format 2023-01-07

But customer wants to filter the date in dd/mm/yy When we pass the date in exposed filter in such format 07/01/2023 ,the ...

Score: 1
milawithict avatar
Passing preprocess function variables to a template
er flag

I am trying to include another template file with pre-process's theme hook variables in a template file but it failed. I checked theme debug and it does not include example's pre-process theme hook. Can you give me guidance?

I added {% include 'example--p1.html.twig' %} in the page--front.html.twig file. The example--p1.html.twig file has one variable, {{ test }}. Also, I created a pre-process funct ...

Score: 3
TwoMice avatar
Custom module name conflicts with unsupported contrib module -- how to avoid "This project is no longer supported" warning?
pl flag

This Drupal 9 site runs a fork of the search_file_attachments module, modified for custom purposes, and for Drupal 9 compatibility.

For some time now, the Available updates report has shown, for this module, the warning "Project not supported: This project is no longer supported, and is no longer available for download. Disabling everything included by this project is strongly recommended!"

I inten ...

Score: 0
Commerce migrate and upgrade
cn flag

I'm going through the process of migrating from commerce 1 -> 2 and everything works from the product / order /payment perspective but I can't figure out how to re-map other content types that reference the old product node type.

This is my old structure

node -> node -> product review -> book -> product

New Structure node -> product review -> book

I have all of my migrations e ...

Score: 0
Adrained avatar
Webform entity reference view?
gb flag

I want to have a field to select a webforms within a paragraph using an entity reference field in the "Views: Filter by an entity reference view" reference mode, so that I can reduce the number of options particular authors see.

However, "webform" is not a valid selection when I go to create a view. I see "webform submissions" but not "webform." Is there a different webform submodule that I have  ...

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.