Questions tagged [8]

Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
0
votes
0answers
44 views

Date range issues with timezones in twig

We're using date ranges for some events in an application. We're finding that when we use the date value and end_value independent of one another then the timezone is incorrect. For example, inside a ...
0
votes
1answer
29 views

Problems rendering radio buttons after an ajax call

I'm going to be linking this D.O issue. I found that when changing an attribute other radio buttons would not update properly. Specifically that when there was two possible options for these buttons ...
0
votes
0answers
10 views

Sort tags in a view by the number of content they are displayed in

I'm trying to make a view that would display only name of tags and the number of content that uses that tag. I have managed to do this following this tutorial: https://www.youtube.com/watch?v=...
0
votes
1answer
25 views

How can I print a custom message for unpublished nodes upon submission?

Structure > Content type > ContentX > Edit > Unchecked published. Structure > People > Permission > Anonymous users have access to create node for Content Type "ContentX". An anonymous user goes to ...
0
votes
0answers
41 views

Why is my site status continuing to indicate mismatched field definitions after updating?

When I visit /admin/reports/status, I am told that a few entities have fields that need to be updated or reinstalled. I created an update hook: /** * Remove the result field from the analysis ...
0
votes
1answer
49 views

How to execute custom code at Drupal startup

What's the correct way to execute code from an existing custom module at Drupal startup? The code checks certain private_tempstore values and sets other values based on what it finds. It should be ...
0
votes
0answers
12 views

Allow translate content by custom validation

I have an X content type. Also, there is a role with permissions that overwrite those of Drupal. I'm trying to get an user with the custom "translate" permission to create/edit translations based on ...
0
votes
0answers
20 views

Custom entity's exposed node reference filter

I have created a custom Entity using drupal generate:entity:content. This works great overal: I can use it in my code like I want. One of the table columns of the entity is a node-reference. This ...
1
vote
1answer
46 views

How to uncache jsonapi?

As usual, I am debugging something and this time, it's jsonapi. I already have $settings['cache']['bins']['render'] = 'cache.backend.null'; and $settings['cache']['bins']['dynamic_page_cache'] = '...
0
votes
0answers
25 views

Disable error on user login / register form

I've been trying to disable the error on top here : I have not been able to find the source of it. Doing messagesByType(TYPE_ERROR) does not return this error. I can see it within $_SESSION['...
0
votes
0answers
35 views

Change date format in cck field

In Drupal 8 i would like to change the date format in cck date field of a custom content type . For example i would like to have french format d/m/Y . How can i do this ? I've try this code that i ...
0
votes
1answer
30 views

Is there any way to get only the custom roles?

I would like a list of all custom roles. Currently I am loading all of them using $roles = $this->entityManager->getStorage('user_role')->loadMultiple(); but am wondering if there is any ...
0
votes
0answers
13 views

How do I automatically put width and height in the img field in CKEditor?

How do I automatically put width and height in the img field in CKEditor? I'm making my site AMP capable. I'm struggling in converting <img> to <amp-img>. I already managed to convert &...
-1
votes
0answers
18 views

Multiple variations don't behave as expected [closed]

I am using the Drupal Commerce 2.x module for my website. I have created a product and configured multiple variations of it. Everything in the configuration looks good and well for me. The Product ...
0
votes
0answers
22 views

Create specific view for all categories

I have a list of Categories defined that all have specific URL aliases defined. I'm trying to set up views for those specific feeds. For example, if I have categories cats, dogs, fish (with aliases /...
1
vote
1answer
37 views

How to create a page to custom display of particular node type and add it to node context menu?

I created custom node type, let's say "My Node". I created custom node display type (at /admin/structure/display-modes/view), let's say "Specialized Display". Configured the "Specialized Display" for "...
0
votes
0answers
13 views

OpenModalDialogCommand in form not working

My form code is as follows. I am not able to figure out why the dialog box is not coming. This used to work before. The only change that I did was updated drupal to 8.8.2 version and it stopped ...
1
vote
1answer
32 views

How to populate an Entity Reference field from a modal AjaxResponse?

I have an entity ref autocomplete field (reference to bundle A) in one of my bundles (bundle B). I want to add a button below this field which will open a modal for a bundle A create form. This code ...
0
votes
1answer
28 views

Create configuration storage programmattically for list_string

On a paragraph type, I have a field I want to migrate to a new field of type "list_string". To do that in the deployment and like our automatic deployment begin by an update of the database follow by ...
-1
votes
0answers
19 views

How do I show enabled themes in form select list?

I am new to Drupal 8. I want to show all enabled themes in form select list in Drupal 8. I have add group form (id = group-drupalcamps-add-form). I renderd this form with hook_form_alter() and also ...
0
votes
1answer
19 views

simplesamlphp_auth installation fails on Centos 8-server

I am trying to install simplesamlphp_auth to Centos 8/Drupal 8 server according the instructions on: https://www.drupal.org/docs/8/modules/apigee-developer-portal-kickstart/integrate-simplesamlphp- ...
-1
votes
1answer
25 views

Get all the paragraphs of the current node programmatically in form_views_exposed_form_alter

I have a content type with multiple field paragraph. I would like to get all the paragraphs from the current node in form_views_exposed_form_alter. I tried $node = menu_get_object(); $storage = ...
0
votes
0answers
14 views

Possible to set image style based on aspect ratio instead of px dimensions?

I'd like to create an image style that uses an aspect ratio, so that images maintain their general dimensions but get cropped based on that ratio. Essentially this would mean that a 16:9 image style ...
0
votes
0answers
22 views

Should I keep the '#theme_wrappers' => array() for form fields?

I am migrating a few custom modules from Drupal 7 to drupal 8 that contain a lot of forms built using the form api and contain fields like this one: $form['type_document'] = array( '#type' => '...
0
votes
3answers
45 views

Override templates for one view page or block

I am trying to figure out if there is a way to override the base templates for one view. I created a page with a view called 'Promotions'. I need to override the views-view-field.html.twig, views-view-...
0
votes
0answers
15 views

Schedule email to user 7 day after registration with the rules module

Has said in this question Schedule an email to be sent to new users a week after registration , sending a email multiple day after user registration was easy with the rules scheduler module in D7, but ...
0
votes
3answers
61 views

Programmatically add cache max-age

I tried setting the cache max-age to 0 in hook_views_pre_view, in hook_views_pre_build and in hook_views_query_alter but it just doesn't work. Eg: function my_module_views_pre_build(ViewExecutable $...
0
votes
0answers
28 views

Add database connections on the fly, instead of defining them in settings.php

I am trying to add DB Information on the fly, instead of defining in settings.php I am adding connection on module install $other_database = array( 'database' => 'pantheon', 'username' =>...
-3
votes
0answers
17 views

How to create filters for product fields in Ubercart?

I have installed ubercart module in drupal 8. I want to display filters on ubercart catalog page. Please help me How to add filters on ubercart catalog page.
0
votes
1answer
38 views

How can I prevent composer from detaching a module's head?

How can I prevent composer from leaving a module's git status as a "detached head" when updating Whenever I use composer to install or update one of my modules or themes, it downloads and overwrites ...
0
votes
0answers
12 views

Assign image created with imagick to a field

I am using imagick to create an image from the first page of the pdf. I want to assign this image to another field called field_image. How could i do it? Here is the code: $fp_pdf = fopen($pdf, 'rb');...
0
votes
1answer
76 views

Route callback for RegisterForm results in Call to a member function getEntityTypeId() on null

My objective: Let say there is a role named "author". I would like to have a registration form having this path: /register/author, when the user submit, he/she will get the author role (same for any ...
0
votes
0answers
27 views

Custom webform validation handler not getting called using Event subscriber

I am trying to implement a custom validation for webform. I need to validate if user entered email is valid or not. For that I have altered the webform using event subscriber and assigned a validation ...
0
votes
0answers
12 views

Add new button with form_alter hook and AJAXify it

Is it possible to have form created via Webform UI and using hook_form_alter, add a Button, which calls ajax function? This is code from my hook_form_alter function. But ajax callback function is ...
0
votes
1answer
32 views

How to set a new value in a paragraph field on submit?

In an edit form for a content with paragraphs, I set errors on the paragraph specific field with this particular syntax: $form_state->setErrorByName('field_paragraphs][' . $key . '][subform][...
0
votes
2answers
41 views

Can I somehow edit libraries.yml files from the backend using the admin panel?

In my Drupal project, we load custom CSS for some of our specific pages. Right now I do all of these modifications programmatically. But what our manager wants is to create it manually in the admin ...
0
votes
1answer
33 views

How to display an alternative text if the comments are closed for the node?

in my node type template, how do I display alternate text if comments are closed for the node ? {% if content.comment %} <div class="card mb-5 p-3 shadow"> {{ content.comment }} ...
-2
votes
1answer
35 views

Nonexistent route breaks the site

I'm new to Drupal and have been using a few modules to build a site. I've installed link icon and have used it to make a block type and a block which I have then deleted. Then an error like this ...
0
votes
0answers
35 views

How can I change the site settings email using Drush?

Env: D8/drush-9.5.2 I need to use drush to change the site details (Home->Administration->Configuration->System) Site name, Slogan, and Email address. I found the configuration key by running: ...
0
votes
0answers
25 views

How to allow per-node layout customizations for a view mode?

I'm using D8's Layout Builder for a custom content type. The content type has multiple view modes. Each view mode will use Layout Builder. The "Default" view mode has a layout option to "Allow each ...
-2
votes
0answers
29 views

How to restore content from a corrupted database

While doing an update recently I think something happened to my mysql database which causes problems with the website when I try to use it (The table itself isn't showing any corruption.) I'm trying ...
0
votes
1answer
31 views

Why is my Ajax callback not returning anything?

I'm implementing an ajax callback function whats the issue with my code not returning anything. I'm new to backend <?php use Drupal\node\Entity\Node; use Drupal\Core\Form\FormStateInterface; ...
0
votes
0answers
19 views

View footer summary

I would like to add a footer to a view with a summary with some row calculations. I have tried creating a plugin (AreaPluginBase) but It doesn't give me the rows nor the arguments of de view. I've ...
0
votes
1answer
27 views

Returning from ajax callback ruins view

Currently I am hooking into the add to cart form on my website. I added ajax to the edit quantity buttons like : $form_quantity[$key]['#ajax'] = [ 'callback' => 'update_cart_order', ...
1
vote
2answers
128 views

Upgraded to 8.8.3 and now all of my modules say “No available releases found”

I just recently updated to 8.8.3 and for some reason, all of my modules now say "No available releases found". Also the one module I had that did report "No available releases found" (Video Embed for ...
2
votes
1answer
31 views

How to add local task links to referenced entities for a specific content type?

I have a content type with some entity reference fields to another content types. I want to add local task tabs to the node view page, to link those referenced node. However I cannot figure it out how ...
0
votes
2answers
40 views

Storing ajax callback variables in PrivateTempStore

I have an issue with changing / obtaining variables in form element's ajax callback function. (Sorry for typos, I just placed a pieces of whole code). I have form with input field, where user can ...
2
votes
2answers
49 views

How to properly restrict node access (including update/delete) based on field value?

I have following requirements: Users have (among others) role "tier1", "tier2" or "tier3". Higher value means more permissions and anonymous users are considered "tier0". Users from tier2 and tier3 ...
0
votes
0answers
65 views

Can IMG URI be displayed in image.html.twig?

I want to include Magnific Popup in my site. The only thing that left to do is display the URL of the image in link wrapping the image field. I saw that image.html.twig modify the image of my ...
1
vote
0answers
65 views

Getting granular data in template from an entity referenced in the entity_reference field, in a way that would respect Drupal's caching

I have a case where in my node's template I need an image style URL from the Media entity referenced by this node. I need a raw value of this URL to use it like that: <div style="background-image: ...