Questions tagged [8]

Version tag to tag issues specifically related to Drupal 8.x. Please note that version tags should be used only 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
1answer
7 views

Save 2 logos in custom theme

I need to save in theme 2 custom logos and use them on the site. Can I somehow create custom field in theme or maybe save the path to another logo in one of the .yml theme files?
0
votes
1answer
31 views

Adding Field To Bundle-less Entity On Installation Not Working

I have several fields that I'd like to attach to a custom entity upon installation. I am trying to follow the suggestions here to attach fields to my custom entity (which, by the way, has no bundles). ...
0
votes
3answers
53 views

How to redirect a user on login?

I have a registration form, when submitted, the user gets logged in automatically. I want to redirect the users to a specific page on login. Whether they are logged in using the login form or through ...
0
votes
1answer
21 views

How can I programmatically deactivate multiple user accounts?

I have tried the following code, but something doesn't work, could you please help. I need to deactivate several accounts at once, if they satisfy the conditions: $ids = \Drupal::entityQuery('user') ...
0
votes
2answers
40 views

What's the purpose of subfolders inside a theme's templates folder?

What is the purpose of folders inside the templates folder in a theme? Where is specified that when rendering a page the template should be taken from layout/page.html.twig? Or a single node template ...
0
votes
1answer
24 views

Can I use the Migrate module to sync a site database with a Filemaker Pro database?

Is it possible to get data from a Filemaker Pro database and insert it into the database for a Drupal site? Ideally, I'd like to set this up so that Drupal would periodically check the Filemaker ...
0
votes
0answers
9 views

Regular expression in Drupal Conditional fields module not saving values

I am using using Conditional Fields 8.x-1.0-alpha4. Is there is a problem with conditional fields that use regular expressions? Values are nullified after saving the node. My control field is a list ...
0
votes
0answers
13 views

Updating Pathauto fails [closed]

Extreme PHP and Drupal beginner here, trying to contribute to an existing site. I'd like to update Pathauto to 8.x-1.5, which results in: Fatal error: Declaration of Drupal\webform_ui\Form\...
0
votes
1answer
32 views

How can I prevent “Log in to post comments” from displaying for anonymous users?

How do I remove the "Log in to post comments" from the bottom of my content in Drupal 8 while keeping old comments visible to all and allowing existing registered users to still comment? Basically, I ...
0
votes
1answer
32 views

How can I specify background color and image for a block or node?

My web page consists of vertically aligned blocks. Each of these blocks/nodes may have a custom background color or image. I am entering the background color/image within the specific block. How can ...
0
votes
0answers
10 views

Bulk update fileds integration with Address field

I am trying to bulk update nodes that contains Address field using the bulk update fields module with no luck. I created an ticket in the issue log and had a response from the developer, nevertheless,...
0
votes
0answers
29 views

How to remove fieldset wrapping radios and checkboxes elements?

so, Drupal 8, by its default internal process of rendering Forms, wraps radios and checkeboxes group in fieldset element which makes the html output little bit complicated. How to alter such ...
1
vote
3answers
112 views

Injecting metadata into all nodes within one folder

For my school I need to add metadata into the tag of every node/page within the folder /course/ The metadata is the same for every page in this folder: <meta class="swiftype" name="tags" data-...
0
votes
1answer
37 views

Is there a way to selectively export specific relevant configuration into custom modules?

I'm learning D8 and gaining familiarity with the configuration management aspects of drush. All my configuration is exported into my config/sync directory and I cherry picked the relevant files and ...
0
votes
1answer
27 views

Displaying multiple fields in referenced webform option?

First I have a content type Quiz option which represents one option (answer) for a webform question (field). Then I have a (entity reference) view which is collecting specific number of nodes in this ...
3
votes
1answer
40 views

Is it possible to override/replace an event subscriber

I would like to replace an event subscriber. Is there any way that I can write my class implementing EventSubscriberInterface which would replace another existing event subscriber instead of being ...
0
votes
0answers
23 views

Search api sorl not working with views [closed]

Configuration: I am using Drupal 8, search api and search api solr8.x-3.7. i fallowed all step according to this link https://git.drupalcode.org/project/search_api_solr/blob/8.x-3.x/INSTALL.md ...
-4
votes
0answers
35 views

Page redirect only works once [closed]

I set the event when content A is viewed, then the action is to redirect to another page. It works but then, when the same content is viewed for the second time it will no longer redirected to another ...
2
votes
0answers
44 views

Why path prefix is always leading to en instead of User's preferred language?

I am working a multi-lingual website which has 9 languages enabled. But the issue I am facing is irrespective of user's preferred language, site will be always prefixed with en. The required behaviour ...
3
votes
3answers
89 views

How to determine if loading a form or submitting a form in hook_form_alter?

I am trying to put a simple message at the top of a node edit form when a user is creating a new node. I added a \Drupal::messenger()->addMessage() inside a my form_alter hook but this prints when ...
0
votes
1answer
25 views

Template preview not working properly

I've got a huge problem with my template preview. For all of my post (page, article and so on), I have not the good region in my page. My theme is extended Classy. If I go to see the page (not ...
0
votes
1answer
34 views

Double values (products) in Commerce cart form

I use Drupal Commerce version 8.x-2.15. I have a multilingual Drupal site with multiple languages based on domain. mystic.com -> EN language mystic.eu -> NL language etc I added relationships: (...
2
votes
1answer
51 views

How to delete all revisions of given content type except the current revision?

I am having a very large website which have around 400000 nodes of story content type. And these nodes have around 2000000 revisions. How can I delete all the revisions except the current revision so ...
1
vote
1answer
47 views

How to redirect the user to an external website with POST data?

I want to implement an offsite payment method and everything is going well except the fact that I can't find how to redirect the user to the offsite payment gateway after submitting the cart checkout ...
1
vote
2answers
46 views

How can I programmatically add a field to a field group?

I have tried this code but it is not working. $form['field_test'] = [ '#title' => t('test'), '#type' => 'radios', '#options' => [t('A'), t('B'), t('C')], ]; $form['#group_children']['...
0
votes
3answers
80 views

Database deadlock detected

On Drupal 8 we're getting a few deadlock conditions - most connected with the cache. There are quite a few answers to this issue but not so much for D8 (which has very different caching mechanism). Is ...
1
vote
1answer
26 views

How can I return a JSON response from an internal function ? (not the main callback)

I have a callback that is running for a specific post request. I am returning a certain JSON response at the end of it. What if I want to catch errors inside one of the functions that are ran in that ...
0
votes
1answer
26 views

How can I translate the field group description?

I have created two field groups on the manage form display tab for a content type. I have added some description also. On the interface translation, I can translate the field group labels but there I ...
-6
votes
0answers
34 views

Cannot create content with a title of author's name and the current date (eg. userA 25 Nov 19) [closed]

I have issues regarding Rules D8. When a user is created, cannot create a content with a title of the node author's name and the current date (eg. userA 25 Nov 19). Problems at data selector / token ...
-2
votes
0answers
45 views

Problem setting up simple content moderation

I am trying to set up a very simple moderation workflow in D8 and am completely stuck. Authenticated users should be able to see their own unpublished content but not other people's unpublished ...
2
votes
1answer
25 views

How do I render a submit button so that it's disabled initially and enabled by JavaScript?

We have a form that includes a React JS frontend component. The component collects some required information, which the React component then supplies to the backend by populating a hidden form field. ...
1
vote
1answer
41 views

How to create a user with custom fields?

On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called '...
0
votes
1answer
40 views

How can I display the time passed since a comment was created instead of the creation date?

how to personalize my comments ? I want to display since when the comment was created instead of the date. I want to display the comment ID with the link "permalink". Can you help me ? Thank you ...
1
vote
1answer
29 views

Using group and rules modules to automatically create group for new user

I am using the Group (not OG ...) and rules modules for this task. I created group type, Applications Support. Then I created a rule, After saving a new user. Under the rule, I used the following ...
-3
votes
1answer
30 views

Drupal queue item not being processed [closed]

I am creating queue items from a cronjob. But it seems they are not getting processed. Any ideas why? Do we need to process the items separately? I mean i have created the worker class and everything....
0
votes
1answer
24 views

Display text in an empty field group tab using custom code

I have created a field group with an empty tab. I would like to use custom code in a module to display something in this empty tab - it will just be a render array. Can someone show me how this can ...
0
votes
1answer
24 views

How to update cart after deleting line items?

I have an Application (app) node that when it gets created (hook_node_insert) I add line items (based on info in the app) to my cart. This works great. Step 2 now is that when I add a new app, I ...
0
votes
1answer
33 views

Create a draggable table and save weights

I'm struggling a bit with creating a draggable table. I want to have a table that lists node labels, where it's possible to rearrange the order of the nodes. The new weights shall be available when I ...
1
vote
1answer
32 views

Limit multiple fields node add form

How can I (either with a module or programmatically) limit the number of values for multiple fields? For example, the user can add only a single value for field A OR field B OR field C. The total ...
-2
votes
0answers
24 views

Show view as menu item [closed]

I want to build a list of links with Views. And then show this list of links as submenu in the Main Navigation. This used to be possible by using the Menu Views in Drupal 7. What method should I use ...
2
votes
1answer
39 views

How to Restrict views Date popup to only year/month

I want to have views exposed filter on node created field with popup. I've installed date_popup, the popup appears but I'm looking for a way to restrict it to only year and month. I tried the ...
0
votes
0answers
19 views

How do I add the View field to another View?

I'm trying to add a field for Revision Author to /admin/content following the instructions located here: How do I display the last person that edited content instead of the original author? When it ...
-1
votes
1answer
28 views

Multi-Vendor Marketplace functionality is not completed in Drupal 8 commerce

I was at the edge of launching a Multi-Vendor Marketplace with Opencart which is quiet as easy as installing an extension and I am ready to go ! However, I am better in Drupal Development and I like ...
-6
votes
1answer
40 views

Different front page for logged in users [closed]

I want to show different front pages for different roles: Anonymous users should see www.domain.com\front, logged-in users should see www.domain.com\dashboard. There are two options I found so far: ...
1
vote
1answer
33 views

I don't find something similar to drush field-create in Drush 9

I'm looking for a similar command drush field-create with Drush 9, I only find drush generate field but when I execut it I don't get nothing, also if I try drush generate field --help I get: Too ...
0
votes
1answer
74 views

AJAX form submit error when sending form to twig in hook_preprocess_page

I have a simple AJAX form that I can't submit when the form is passed from module to the template in hook_preprocess_page. The same form works fine if sent from controller, it's just that the layout ...
0
votes
0answers
46 views

Handle nested Exceptions in delete hook & Ignore DrupalKernel Exception handler

I have functionality that checks if entities can be deleted or not. These entities are vast and most of them are linked together with EntityReference fields. Now in some cases I want to check if an ...
2
votes
2answers
84 views

Loading taxonomy terms in a tree in Drupal 8

I have multiple level of vocabulary, I want to display all level in the hierarchy same as taxonomy display. My taxonomy is like. All Drinks Alcohol Drinks Beer Vodka ...
1
vote
1answer
44 views

Preprocess a twig template file

I don't fully understand how preprocessing works I have a twig template /themes/custom/client/templates/content/node--myfile.html.twig that I want to alter I want to show/hide a part of that ...
-1
votes
0answers
50 views

How to figure out cache ID I want to use?

If I use: $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); $cid = 'return_products:' . $user->id(); $data_cached = $this->cacheBackend->get($cid); I get cache info ...