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
-2
votes
0answers
18 views

Find anchor tags

How do I create or find existing anchor tags in Drupal? The website I'm working on has anchor tags for two buttons on the home page, but are labeled #anchor14 and #anchor29. Not very descriptive and ...
0
votes
0answers
35 views

Getting InvalidArgumentException for UpgradeStatusForm after installing the upgrade_status module on a Drupal 8 site

I have a very old install that began with 6 and is now at 8. I'm trying to get it updated to 9 but have gotten stuck with getting the upgrade_status module to work. After it was installed via composer,...
-5
votes
1answer
21 views

Recaptcha in webform with enabling webform ajax break the form and not validating recaptcha

I am using recpatcha in webform with enabling webform ajax. I am able to submit form without captcha. which is an issue. form should not be submitted without captcha validation. if I click on submit ...
0
votes
1answer
17 views

Primary tabs display differently for different roles?

In my Drupal 8 site (using the Seven theme), the primary tabs navigation are displaying differently for different roles. See screenshots below. It would appear that for the limited Editor role, it's ...
1
vote
0answers
11 views

Programmatically load the same view multiple times with different contextual filters values

I'm trying to load a view X times but with a different contextual filter value each time. My code generates the correct amount of view blocks, but they are all the exact same. They all correspond to ...
0
votes
0answers
35 views

The use of contexts in a Drupal.t() function in Javascript

According to the documentation, we can use contexts with Drupal.t() since Drupal 8. Drupal.t('May', {}, {context: "Long month name"}); works fine, but Drupal.t('May', {}, {context: "...
1
vote
0answers
14 views

Search: Do not index some parts of HTML

We're indexing the rendered HTML output (rendered_item, type "Fulltext") of pages into elasticsearch using elasticsearch_connector. Some parts of the HTML shall not be indexed because they ...
0
votes
0answers
54 views

Twig templates with lots of classes?

I have created a twig template and have added classes like below. {% set title-classes = [ 'title', 'h1', ] %} {% set subtitle-classes = [ 'subtitle', 'h2', ] %} <div{{ ...
0
votes
0answers
30 views

How can I filter based on unique taxonomy term values?

I have a content type "book". One of its field "field_language" referencing to "language" taxonomy term. field_language can have only one value. Consider this is the ...
0
votes
1answer
15 views

Node reference field autocomplete and allow multiple selections in views

I recently pdated my Drupal core to 8.9 and suddenly a functionality stops working. I have a "Recipe" content type, it has a field of "Category" (field_category) which is Entity ...
0
votes
0answers
7 views

Using group module, get SUM from the groups content in a view

I am using the group module and each group can create "tournaments" content. Within that content is a multivalue paragraph that contains a user id and a number field. Using views, I would ...
-1
votes
0answers
26 views

Views "freezes" SQL: strange bug since D7 and till D9

Sometimes I face with the following problem: views "freezes" SQL query. So I change filters, add/remove fields, but I see the output as well as SQL query is the same. The output can become ...
0
votes
0answers
31 views

Is there Drupal Twig built-in ability to get content of page

Is there built in Drupal Twig ability (tag) to get content of another website's page like file_get_contents() or cURL do in PHP? Under "built in" I mean without adding a PHP code to a ...
0
votes
1answer
41 views

Why do some Drush commands only run from docroot?

Wondering if anyone knows why some Drush commands (with file parameters) only run from the docroot and won't run from the project/composer root? Commands such as drush sql-query and drush locale-...
1
vote
1answer
24 views

Loading a field value within a twig template

I'm building a multi-country website using Drupal 8. The company would like to have each region manage their website independently but still have a "global" site. I'm building a theme which ...
0
votes
1answer
54 views

Middle part of a page disappears and appears again after flushing all caches

Sometimes middle part of some page at our website may disappear and only header and footer are still displayed. The problem is always solved after flushing all caches. Our html.html.twig loads ...
-2
votes
1answer
34 views

Pass multiple value in an session

How we can pass multiple value in an session variable $session = \Drupal::request()->getSession(); $session->set('session_anme', $variable_name ++); if I add value 1 and 2 and 3 The value ...
1
vote
1answer
9 views

Disable certain rows of a Entity Reference Source view

I have a field that is an entity reference on a piece of content. I created a view that is an Entity Reference Source and set the reference type on the field to that view. When editing the content, I ...
0
votes
0answers
9 views

Creating tabbed config settings

I'm trying to create a tabbed configuration page for my custom module, although I can't see a lot of information on exactly what is supposed to be done. I've seen this page but it's not exactly in ...
0
votes
0answers
25 views

How to access data in Twig in module extended template

I'm new at developing Drupal. I'm using Drupal 8 and I want to display datetime fields in a special way. Here is how my module_name.module and template file looks like: function module_name_theme($...
0
votes
0answers
14 views

How to use views query alter to show filtered content according to tags

I am new to Drupal and started learning hooks. I am trying to use hook_views_query_alter to show related content to user according to it's preferred tags. function related_content_views_query_alter(...
1
vote
0answers
20 views

Restrict a Media field to allow selecting only a certain file extension in an existing Media Type

Is there a way to restrict a Media field using an existing Media Type (File) in a Content Type to permit only a certain file extension in that instance? In particular, I need a subset of the permitted ...
1
vote
1answer
21 views

Error when trying to view revisions

Using Drupal 8/9. When trying to view previous revisions I am getting the following error: Error: Call to a member function getType() on string in clc_d8_theme_theme_suggestions_page_alter() (line 13 ...
0
votes
2answers
43 views

How to cache View block by content language?

I have a very simple (block) view to list a node's title. This view has an id from url contextual filter and a single filter to filter on Content language set for the page (by URL prefix). This block ...
0
votes
0answers
10 views

Render a commerce checkout pane programmaticaly

I need to render the order review pane in a (ajax) controller. What would be the simplest way to programmatically get the order review pane markup ?
0
votes
0answers
15 views

Does Views block caching include language in cid?

I think this is likely a core bug (in which case I know it is not meant for Drupal Answers) but thought I would check here first to see if possibly I have just missed something in configuration? I ...
0
votes
0answers
16 views

How to set an encrypted file field's value programmatically

I'm trying to set an encrypted file field's value programmatically. I'm using Encrypted Files module. I have successfully configured a file field, and it works for the contents created using the node ...
0
votes
0answers
19 views

Can't find "starts with" for Filter criteria In Views (indexed field for taxonomy)

I created a view using indexed fields (search api) to list a taxonomy. I used the rest export checkbox so I have an api endpoint for my view. I am not able to find a filter criteria "starts with&...
2
votes
1answer
42 views

Safely save data to the order in onNotify()

I'm new to Drupal and have to make an off-site payment gateway (with Drupal Commerce 2). It all works, but sometimes it doesn't. The remote payment provider's server sends notification requests to the ...
0
votes
1answer
37 views

Managed file in theme config not saving

In my theme settings under 'admin/appearance/settings/mytheme' I am trying to add an image field. I have added the following to mytheme.theme function mytheme_form_system_theme_settings_alter(&$...
0
votes
1answer
27 views

Get the value of Entity reference revisions field in order email twig file

I want to get the entity reference field value in order email. Name of the entity reference is field_price_value and called paragraph field is field_price now I want to get the field price value I ...
0
votes
0answers
27 views

How can I make a white screen of death less ugly

A project I'm working on requires custom modules, and I'll be the last person to claim that I am perfect. I've gone through and removed as many possible php errors and causes for WSODs that I can ...
2
votes
1answer
33 views

Custom AJAX Response not firing on Flag action

I'm trying to run custom javascript functions at the same time as people interact with certain flags on my site, I have followed this tutorial on how to respond to both Flag/Unflag actions, and this ...
1
vote
0answers
15 views

Disable the "Add Link" button in entity.menu.edit_form for certain roles

I'd like to hide the "Add Link" button in menu.edit_form for certain roles. Running dpm($form) for this form I can't find that button in there. In core there is menu_ui.links.action.yml with ...
-2
votes
0answers
20 views

Date format for date type fields

I am using a date type fields in a custom form after click on the date pop up I want the date format in mm-dd-yyyy or yyyy-mm-dd but currently its showing dd-mm-yyyy. $form['start_date'] = [ '#type' ...
-1
votes
1answer
26 views

Add a date pop in a field in custom module

I want to add a date pop in a custom field in custom form in custom module This is the library file: custom_lib: css: theme: css/datebasesorting.css: {} css/datatables.min.css: {} ...
0
votes
1answer
24 views

Is it possible to render a region in a menu template?

In my Drupal 8 theme I have a template called __menu.html.twig which gets called in my page.html.twig I am trying to render a region within the __menu.html.twig where I can place blocks. I have ...
0
votes
1answer
33 views

How can I print view/edit/comment links? [closed]

I have a view that uses the "View content," "edit content," and "view comments" fields. I can't figure out how to print these in a custom twig template. I've tried: {{ ...
0
votes
1answer
9 views

Add a second RulesAction to a custom module

I created a custom module containing one Rules Action that works perfectly. I tried adding a second by creating a second php file in the MODULE/src/Plugin/RulesAction folder, with the names and class ...
0
votes
0answers
10 views

How to word-wrap field label from a view

I'm still new to Drupal views, how do I word-wrap a field label from a Drupal view? I know there are style settings within the field and there's one called, "Customize label HTML". Do I just ...
0
votes
1answer
39 views

Send email to author when content is published through scheduler

I have used Scheduler module with content moderation integration to publish a content automatically. It is perfectly working using the module. Now I want to add a functionality that once the content ...
1
vote
1answer
53 views

how to convert date into timestamp using timezone

I am using strtotime to convert date into time stamp but its does not work correctly. I know its relatively to time zone. My drupal store time zone is denver. I am not sure why its not showing correct ...
0
votes
0answers
26 views

Better exposed filter for block view doesn't appear

I created a new content type and a display page to show a listing of all my new content type pages. I'm trying to create a better exposed filter block on my page for the sidebar, but when I try to add ...
0
votes
0answers
11 views

Display Default and filter data of a form on a same page including form

I want to show the date without filter a form that is default data and if user apply for filter and filter should be shown rather to default data including form at the top Basically I have created a ...
1
vote
2answers
209 views

How can I force user logout from a JavaScript library in a custom module?

I've written a custom module for Drupal 8 to monitor user device location frequently. If a user goes out of an allowed zone boundary, I need to force logging the user out of the website. I created ...
0
votes
0answers
32 views

Apply an AND condition in WHERE clause

I want to sort view results basing on the selected start and end dates using exposed filters. So I want to AND the conditions in the WHERE clause. How can I do this? I tried the following code, but it ...
0
votes
0answers
36 views

Custom breadcrumb navigation, but url link shows page node

I'm pretty new to Drupal and I'm creating a new content type. The site uses custom breadcrumbs built using BreadcrumbBuilderInterface for certain content types which was built before my time. I'm not ...
1
vote
1answer
62 views

How to exclude taxes from total prices but still show the tax during checkout

So I create a tax type Custom and set the rate 18%. The checkbox Display taxes of this type inclusive in product prices. comes in checked by default. If I leave it like that, cart shows product price ...
1
vote
1answer
31 views

Unable to use SameSite=none with secure attribute, using Symfony\Component\HttpFoundation\Cookie to create the cookie

I am trying to create a cookie in Drupal 8.9 with SameSite=none with secure attribute, using the Symfony\Component\HttpFoundation\Cookie class but I am unable to do so as the class doesn't allow the ...
0
votes
0answers
34 views

How can I conditionally display fields based on the same paragraph radio field value?

I have added a paragraph where I want to use a radio button to conditionally display text fields from that same paragraph. My radio values are: Select discount in amount -> if checked, then ...

1
2 3 4 5
318