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
1 vote
1 answer
35 views

Set admin theme by user

Is it possible to set a different admin theme by user ? I found this old module https://www.drupal.org/project/tbr it's probably possible to convert it to fit the new Drupal 8/10 system (https://www....
Etienne's user avatar
  • 335
0 votes
1 answer
51 views

Block Plugin not Showing on Certain Pages

This issue has been bugging me for some time and maybe this is just how Drupal is or I am missing something. Anyway, the setup is like this: I have my defined regions on the site. One region is Hero. ...
rtoombs44's user avatar
0 votes
1 answer
84 views

How to disable cache in my custom contextual filter code?

I have created a custom module for authentication by using access_token. The authentication is working fine. So, I thought to create a custom contextual filter and use that as a filter by access token....
Selvakumar Eswaran's user avatar
0 votes
0 answers
28 views

Hide Node Title if Paragraph Type Exists?

How do I hide node titles on pages only when a specific paragraph type is being used? For example, the paragraph field is "field_cta" and it has 3 choices of paragraphs "paragraph_a&...
Sam's user avatar
  • 603
0 votes
0 answers
43 views

How to use hasField but for paragraph fields?

Within a page template, how could I check if a paragraph field if present? I'm using this and it works: $node->hasField($field_paragraphfield) But how can I modify this to look for a field within ...
Sam's user avatar
  • 603
0 votes
1 answer
71 views

HTML style attributes have a prefix in their values after changing directory and settings

I am a sysadmin with some experience in PHP and databases, but a complete Newbie to Drupal. I have a Drupal site I am hosting but it needed to be moved away from the web root to host a new website ...
mr_november's user avatar
0 votes
2 answers
35 views

Migration of Layout builder enabled node to replace block content

I need to iterate through the article nodes that have enabled the layout builder and replace the content block in the layout builder section with a new content block. I need to do this via migration ...
KTM's user avatar
  • 2,372
0 votes
0 answers
21 views

Control order views are considered for display based on contextual filters

I have two different views being used to show two different types of content. One is a view to show a taxonomy term and it has a path like this: /foo/faa/% with % being for the term placeholder The ...
fallenturtle's user avatar
0 votes
1 answer
40 views

Add custom field template for front page only?

Is it possible to use twig template naming conventions to target a field on the front page only? For example, if I want a different version of the header field on my front page I could use field--...
Sam's user avatar
  • 603
0 votes
0 answers
49 views

Update FieldItemBase database schema

I need to update a default value of column /** * {@inheritdoc} */ public static function schema(FieldStorageDefinitionInterface $field_definition) { return [ 'columns' => [ 'status' ...
Vanish's user avatar
  • 146
0 votes
0 answers
51 views

route resolving corrupted

I have a weird situation. Somehow some routes got corrupted and I cannot fix them. So the /user/:uid/edit and /user/register are corrupted, the /user/:uid , /user/:uid/anything-else , /user/login or /...
Marius Ilie's user avatar
  • 3,072
1 vote
1 answer
54 views

admin user interface language is changed to another user's preferred language

I have a weird situation. I as an admin have the preferred language set to English and I want to edit another user that has a preferred language set to something different (French for example). When I ...
Marius Ilie's user avatar
  • 3,072
0 votes
2 answers
217 views

How can I programmatically update an exposed filter? [closed]

I am trying to apply an exposed filter programmatically. If filter 'a' is set to 'apple' I want to set filter 'b' to 'green'. Using this code updates the filter. If a user sets the drop-down filter 'a'...
Saml's user avatar
  • 1
0 votes
0 answers
120 views

How can I programmatically get the node title? [duplicate]

A drupal newbie here. I'm looking to build an "issues navigator", a custom block displaying a menu. I'd like to set the "current issue" automatically, from the title of the node ...
Victor Pudeyev's user avatar
0 votes
0 answers
140 views

Getting existing composer managed site to legacy-project composer managed

[Update] I seem to be making some actual progress by just replacing the the composer.json with https://github.com/drupal/legacy-project/blob/8.9.x/composer.json and then doing a composer require [all ...
Chris Rockwell's user avatar
1 vote
2 answers
102 views

Can I populate a select form element with options in separate file?

I have a text file which is a list of 100s of rows. Which I am trying to turn in to a select list. I have created a module, in mymodule/src/form/mymoduleform.php. I am trying to load the items from ...
David's user avatar
  • 21
2 votes
1 answer
110 views

Search API autocomplete view mode template

I got search api autocomplete setup and using the live results feature I was able to set it to use my Search Autocomplete view mode. I am trying to figure out what the twig template name would be. Any ...
Ronnie's user avatar
  • 487
0 votes
0 answers
77 views

Migrating content from production to development

I have a multilingual site built on the Glazed Drupal CMS installation profile (Drupal 8). It was upgraded to Drupal 9, but the upgrading process lasted around 3 months, and now new content from the ...
Alex Sh's user avatar
  • 11
0 votes
1 answer
298 views

Programmatically saving data in a field under user account

QR codes have been printed out for a bunch of students in a university. When they visit the site via those QR codes, and they are logged-in, the refcode query parameter used in the link needs to be ...
Maher B's user avatar
0 votes
0 answers
204 views

Query to order by specific item to be first and then to sort the rest with id desc

I am into a unique requirement where I need to sort records to show specific data first and then rest sort by id descending. I am able to see records using SELECT * FROM jobs where type='jobs' and ...
Tejas Damre's user avatar
0 votes
1 answer
102 views

How to save a customer profile to address book in Drupal Commerce using JSON:API

In the commerce order checkout page, if you use "Save to my address book" checkbox in the billing address section, the address is getting saved to the user's address book. But if I am doing ...
Farhan Erooth's user avatar
0 votes
1 answer
103 views

Programmatically remove duplicated nodes without changing the number of nodes shown per page

I have a content type called Página de área (Area page) referenced by two content type: Article and Agrupador. I have a view that displays all the Article nodes that share at least one area with an ...
Jordi Bustos's user avatar
0 votes
0 answers
29 views

Views posts not displaying correctly until clearing the cache

I have an issue with a Drupal 8 website. I have some pages that have views listing some contents ( text and images). The websites uses CDN and varnish. The problem is that sometimes, the contents like ...
el sparrow's user avatar
0 votes
0 answers
33 views

search api views, sort by most viewed?

I have a view of content. I have enabled the statistics module and in the view I can add Sort: Statistics: Total Views. I am now trying to make a similar view page but using search api. Have enabled ...
May 's user avatar
  • 163
2 votes
0 answers
46 views

How to group taxonomy terms by depth in views?

my example taxonomy looks like this: - fruit -- apple -- orange -- banana - vegetable -- carrot -- cabbage i want to render a page in views that groups level 1 terms by their parent term, The ...
Tomáš Bažant's user avatar
0 votes
1 answer
717 views

How to get value from object in twig template file? [duplicate]

I can print the result object by {{ dump(item.value['#result']) }} in theme item-list--search-results.html.twig template file. I want to print the body field value("body"=>"value&...
Ramalingam Perumal's user avatar
1 vote
1 answer
1k views

Why does the error 'You have requested a non-existent parameter "site.path"' occur on module configure buttons?

When I click some configuration buttons for example in layout builder UI or the following buttons. I get the following error in admin/reports/dblog Symfony\Component\DependencyInjection\Exception\...
Jordi Bustos's user avatar
1 vote
0 answers
363 views

Content moderation and changing node state on default or latest revision

I am using content moderation and sometimes I update the moderation state of my entity programmatically in a hook node presave for example. I usually have the entity and I can do $node->set('...
arirams's user avatar
  • 11
-3 votes
1 answer
440 views

Get MenuLinkContent object values [closed]

get title and link of a menu link object in. I am trying to get title and link of a MenuLinkContent object and below is my code. I want to get title and link value. How I can get the title and Link ...
New Dev's user avatar
0 votes
0 answers
169 views

Trying to sort rows by a column in views twig template

I'm trying to sort the rows of a view in the table template but can't figure out how to sort by a particular column. I can only get it to sort by the first column. I'm trying to sort a views global ...
davidp's user avatar
  • 1
0 votes
0 answers
42 views

Trying to sort a views result by a global views conditional field

I'm attempting to use hook_views_pre_render in a Drupal 8.9.20 site to sort the results of a view by a global views conditional field and I could really use some help. I've spent some hours searching ...
davidp's user avatar
  • 1
0 votes
2 answers
421 views

How to check if webform has a draft submission?

I'm using hook_webform_submission_form_alter() to prepopulate some form values. When a user saves a draft of their webform submission and comes back to it later, the code in ...
codesmith's user avatar
  • 280
1 vote
1 answer
323 views

How to check for content type in hook_form_alter

I see from the api and various posts that I can identify a specific form to change using hook_form_alter, like this: hook_form_FORM_ID_alter() From experience, I know this can be done in the .theme ...
aharown07's user avatar
  • 382
1 vote
1 answer
25 views

List of fields to put on a REST call

I have a rest resource configured from Rest UI page (let's say /entity/user: POST); I would like to share the endpoint with others devs so they can call the API (create users for e.g.). Where to get ...
Notd's user avatar
  • 43
0 votes
1 answer
131 views

Run custom php code or file in drupal content type form submission

I have this drupal site, there is a candidate registration page where anyone can fill the details (name, gender, address, mobile no etc) and submits and a success node page is displayed with all ...
user3099225's user avatar
0 votes
1 answer
113 views

ReCaptcha doesn't show on Simplenews Subscription Block

I have the subscription form of Simplenews in the footer, which should be protected with reCaptcha. I installed reCaptcha and created a captcha point with the form ID of the Simplenews block. ...
Zeroplexer's user avatar
0 votes
1 answer
135 views

How can I add a button to every row of custom column?

I have created a custom column in the content listing section using hook_views_data(). I want to add a button to the every row of that custom column. Can anyone help me with this issue? function ...
Manav Chauhan's user avatar
0 votes
0 answers
34 views

Views: How to filter content by taxonomy terms that are not selected?

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 ...
0711master's user avatar
0 votes
1 answer
256 views

How to use a Controller method inside a service with dependency injection?

I'm using the diff module for a project, this module has a method inside a Controller that I want to use in a service to reuse code. As this time I'm just calling the method like ...
Adrian Cid Almaguer's user avatar
0 votes
0 answers
64 views

How to import config to a site installed with a profile?

Good day. I’ve installed a profile, made my settings, entered my content, exported config and pushed everything to the repo. Now, when I clone it somewhere else and attempt to install using the config,...
Kartagis's user avatar
  • 612
2 votes
0 answers
227 views

Why doesn't the entity access handler I wrote work when the entity is referenced?

I have set a handler for the access of my entity but when I reference it in another entity, the access is not checked. I want the reference and the entity to have the same access check. Any idea ? The ...
CWolf18's user avatar
  • 21
0 votes
1 answer
335 views

AliasManagerInterface -deprecated Drupal\Core\Path\AliasManagerInterface

Error: The website encountered an unexpected error. Please try again later. TypeError: Argument passed to Drupal{module name}\Theme{class name}::__construct() must implement interface Drupal\...
user avatar
1 vote
0 answers
2k views

Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, boolean given

Ubuntu 18.04.6 Apache2, Postgresql 10, Drupal 8.9.6, PHP 7.2.34 (most of the modules require these versions) I've tried trouble shooting this problem for multiple weeks. I'm attempting to migrate a ...
Nategamer's user avatar
-1 votes
2 answers
1k views

How to get Webform Element value into Custom Token

I am currently working on a Drupal project that involves a Webform. I need to assign the value of a specific Webform element, particularly the IP address element, to a custom token. The goal is to use ...
Barry's user avatar
  • 128
0 votes
0 answers
65 views

How to determine entity where image field is housed?

I need to check if an image media field is housed in a paragraph to remove the alt attribute of that attribute. The same image field could be referenced anywhere. I could remove the alt field it ...
Binny's user avatar
  • 900
0 votes
0 answers
2k views

PluginNotFoundException entity type does not exist when trying to uninstall any module

I've got this drupal website from a client that the another developer created, and they've made a mess with many things in this site. I'm having a problem where every time I try to uninstall a module, ...
Jean da Silva's user avatar
0 votes
1 answer
85 views

How can I attach a newly added paragraph to existing records? [closed]

While editing a form, I needed to delete some fields and add a new paragraph. The issue here is, the newly added paragraph is not initialized in the edit form and that makes sense because the old data ...
Mourad Tlili's user avatar
0 votes
1 answer
292 views

How do I restrict content access programmatically?

Something is baffling me. I have this view of streams to users. An admin may make a stream to themselves, a specific person or everyone. I also have this code in which a non-admin user may see only ...
Kartagis's user avatar
  • 612
0 votes
0 answers
161 views

how to get field image of a referenced entity in paragraph template

I made a paragraph with a referenced entity field to a content type called "tools" Actually I can get the title and body text like that : <h3>{{ content.field_tools_and_services.0['#...
johndoe555's user avatar
1 vote
0 answers
53 views

Count how often a route is called

I have written a custom module that exports nodes in different formats. The module itself works great but now I would to count how often one of the custom routes is called. The desired route in the ...
stopopol's user avatar
  • 141

1
2 3 4 5
316