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
0answers
42 views

How to expose reverse entity references with GraphQL 8.x-4.x module?

Since Drupal 8 doesn't support bidirectional relationship, we need to query manually the reverse entity. Let's say we have 2 entities with a many to many relationship: We can add a field resolver to ...
1
vote
1answer
68 views

Redirect from route when the controller has been changed [duplicate]

I'm trying to redirect to an external URL in a custom controller whenever I land on the 404 page. Right now I alter the controller destination in a route subscriber like this: public function ...
0
votes
1answer
80 views

How do I use hook_preprocess_page_title() on a Bootstrap subtheme?

I've just discovered that Drupal 8 Bootstrap theme doesn't implement all existent hooks. So, for example, hook_theme_suggestions_page_alter() works, but hook_theme_suggestions_node_alter() doesn't ...
0
votes
1answer
40 views

Array not displaying in twig template

Custom twig template is just this: <ul id="rows"> {% for product in products %} <li>{{ product.title }} <a href="{{ product.image }}">Image</a> {{ product.description }}&...
1
vote
1answer
59 views

How can I pass an array from a controller to a template?

I want to render array to twig file I am able to render variables but not array. My php file : public function build() { $vid = 'Sectors'; $terms =\Drupal::entityTypeManager()->...
1
vote
1answer
72 views

Cache-Control response header includes “private”

Why does a vanilla Drupal 8 site add cache-control: must-revalidate, no-cache, private to all the pages? A Drupal 7 site adds cache-control: must-revalidate, no-cache. Is that addition of private ...
0
votes
0answers
32 views

Why Authenticated user not able to submit webform and only admin can submit?

I am creating a webform with just two fields and displaying it on modal popup with Ajax submit. But the issue I am facing is, this webform can only be submitted by Administer role user not by ...
3
votes
1answer
200 views

Is there any convention about the form IDs?

Is there a convention for the form IDs? I see that core sometimes uses module_name.form_name and sometimes module_name_form_name. In my case, I'm using module_name.form_name.
0
votes
1answer
28 views

Setting up multilingual nodes

I am trying to set up a D8 (8.7.9 to be precise) multilingual site and hitting some weird bug. I have a node type basic page consisting of the title field and a body text field. Initially I create ...
0
votes
1answer
69 views

SASS for module CSS?

I have worked in Drupal projects where SASS was used to generate CSS files in a theme (with gulp or compass). I have also worked in Drupal projects where a lot of the CSS (without SASS) was living in ...
0
votes
0answers
25 views

How can I customize the calendar view template?

I am using the Calendar module in Drupal 8. I want to customize the layout of the calendar. For this, I created the views-view-fields--page_week.html.twig template, where page_week is the machine ...
1
vote
0answers
26 views

Styling page-wide sections of an arbitrary page

Normally, the main content container is "centered" so that the page is, by default, not page wide. This works in 95% of the cases. Except for when design calls for a page-wide section (i.e. centered ...
1
vote
0answers
33 views

How to add custom webform email handler if submission is sticky/flagged

I use the bulk operation "Star/Flag selected submission" within webform views to process webform submissions which works nice. I would like to be able to send an email to the author if a submission ...
2
votes
1answer
134 views

How do I get paragraph fields text data without the <p> tags?

I am trying to pass my paragraph field data from Drupal to a component that I have created in Twig. My component echos out data like so: <p class='my-custom-class'>{{ my_var }}</p> In my ...
0
votes
0answers
32 views

Make field required if entity reference field is filled

I'm trying to make some fields required if an entity reference field is filled. This is the code I currently have: $form['node'] = [ '#type' => 'entity_autocomplete', '#title' => $this->...
0
votes
1answer
15 views

How to provide a filter based on json:api for referencing nodes with a term reference field?

I am working with the Entity Share module to synchronize content between Drupal instances and I need a filter to define which content can be shared. My use case is almost identical to the one ...
2
votes
1answer
40 views

Different CSS file when in development mode

Using Gulp I create two css files. One style.css and one style.min.css. Is it possible to load the style.css when developing (locally) and the style.min.css when in production (remote)?
0
votes
1answer
47 views

How to know a user can access node/{nid} and node/{nid}/latest in fastest way

I have a view displaying list of latest node revisions. The view has title field. The website gives users permissions to access node/{nid}(shows latest revision if published default revision doesn'...
0
votes
0answers
19 views

How can I migrate a site to another site with a different installation profile?

How can be D8 sites migrated in Aegir between different installation profiles, and not only between platforms using the same installation profile? There is a solution in Aegir for D6->D7 and D7->D7 ...
0
votes
1answer
33 views

How can we check whether block is enabled or disabled in .theme file?

I am displaying a block in twig and i am passing twig variable from hook_preprocess_page. But the issue when i disable the block from backend still its showing up in frontend. Im not able to get ...
2
votes
1answer
37 views

How do I programmatically delete a node by internal url alias?

How do I programmatically delete a node with a specific internal url alias? Background: We are trying to delete this node so that it can be replaced during an update hook.
0
votes
1answer
16 views

How to move block from a region inside of hook_preprocess_node?

I have added mycustomblock to the header region in our settings (/admin/structure/block). We are using the standard content block and displaying that in the Content region, which is displayed below ...
1
vote
1answer
32 views

Why doesn't the batch process start?

I've created a class that extend the 'FormBase' class to create a form where I can upload a XLSX file to import into custom DB table. To process the import I would use the 'Drupal batch process' to ...
1
vote
1answer
28 views

Is the tags section valid in the info.yml file?

I see in the devel.info.yml file a section named tags tags: - developer But I can't find it on the documentation page. Is the tags section valid in the info.yml file or is it just an error?
0
votes
0answers
7 views

Strong commerce order line items grouping

I need add to cart some Order Line Items grouped to don't allow the user to remove or change the amount of one of them without changing the other too. I can't do this with a unique Order Line Item ...
0
votes
1answer
17 views

Load Media File in Webform Mail Handler

I want to use a single webform to send download links with specific media files to visitors that fill out that form. For example on an URL like this: https://example.com/downloads?media=1234 The ...
3
votes
1answer
44 views

How can I disable meta tags provided by the Metatag module for a custom route?

I have created a custom module for displaying the players information. Module will create dynamic pages and each page will display players stats. With the help of the following links, I was able to ...
0
votes
2answers
22 views

How do i dynamically import changing feed links within a feed

I am uncertain how to approach this. I have a feed with housing cases that is changing constantly. The feed consists of a case number and a feed link to that particular house. Each house has so much ...
1
vote
2answers
36 views

Twig template print all comments but not the comment form

For context: in my template file node--some-node.html.twig i have a grid of items which have a custom comment form on them. The form creates a comment through an API. The form passes the ID of the ...
1
vote
2answers
40 views

How to change the date format in the date field as a select list?

On user registration page, I have added a date field in select list. In the manage form display tab, I can set the order of the dropdown fields like day/month/year or month/day/year But I am unable ...
0
votes
1answer
46 views

How do I print individuals fields in block.html.twig when is a node in a block?

How do I print individuals fields in block.html.twig when is a node in a block? The template is working fine. I can hard code some random text and it is displayed. I just can't display the field ...
0
votes
2answers
23 views

Views footer include twig

Is there any way to include an if condition in views footer. I have to check the total rows {% if [view:total-rows] > 6 %} <div class="btn">View AllEvents</div> {% endif %} But this ...
0
votes
1answer
21 views

Link to node in View with TWIG

I have a set of nodes, some of which are just a title, while others have body and other content. I'm trying to create a view, which lists the node titles. If the body of the node contains content, ...
0
votes
0answers
29 views

Dynamic meta tags and description in custom pages [duplicate]

I have a custom drupal module which will generates pages for players in my site. The players stat data is meant to be updated most of the time, so for ease of use, I have created a custom module for ...
1
vote
1answer
55 views

How can I display the block title when rendering a block using Twig Tweak?

Block title when using twig-tweak plugin, not showing. I created a block-type view. And using the module's cheat sheets, I called: {{ drupal_view('views_name', 'block_1') }}
1
vote
1answer
121 views

Notice: Trying to get property 'nid' of non-object

In Drupal\rsvplist\Form\RSVPForm->buildForm(), I wrote this to get the current nid: $node = \Drupal::routeMatch()->getParameter('node'); $nid = $node->nid->value; I get this error: ...
1
vote
1answer
26 views

How to get a taxonomy custom image field URL value

I've created an image 'field_term_preview' field on the taxonomy vocabulary and trying to get this URL in my custom module: $terms =\Drupal::entityTypeManager()->getStorage('taxonomy_term')->...
1
vote
1answer
50 views

Programmatically check the checkbox of an exposed filter

I need to check a checkbox on an exposed filter for a view based on the url. I can't seem to figure out how to do that. If x is detected in the url, I want to set one of the fields of an exposed ...
1
vote
1answer
58 views

How to store temporary metadata for the remainder of a request?

I am looking for a way to store some additional metadata for the remainder of a request, that should be removed after the request has finished. Sessions or SharedTempStore store persistent data across ...
0
votes
0answers
44 views

Redirect user to a specific page

I'm new to drupal. And I have a project that has a search block on the home page that redirects the user to a page based on the user search terms. Everything works fine but I have a FAQ page that ...
0
votes
1answer
78 views

How to add field content as class in Twig?

I want to add the content of a field (i.e. "workshop") as a class in field-html.twig i tried {% set classes = [ 'field', 'field--name-' ~ field_name|clean_class, 'field--type-' ~ ...
0
votes
1answer
35 views

Where to put #Ajax Callback in webform twig file

I would like to add the Ajax callback settings to my custom composite webform element in the twig file. Is this possible? The callback function is in my custom module. This is NOT a computed twig ...
1
vote
0answers
26 views

foreign keys between tables of the same module [closed]

I'm trying to find out how to create relationships between tables that are created in the same modules. I create my entity with the console and I declare several tables. How can I declare shared keys ...
0
votes
0answers
54 views

Create a View to reference content, get paragraph field and influence how it is rendered?

I am trying to create a Paragraph type that lets a user specify a node to reference, and a couple of checkboxes that influence how content from that node is rendered. I can create a view that gets me ...
-1
votes
0answers
46 views

How can I have a faster remote Database?

I'm new at working with Drupal remote/team. We use git for commit local file, like theme, modules etc. I have used acquia to work with remote DB with different developers but that option is paid and ...
0
votes
1answer
40 views

Need help with twig test template

I'm trying to create a test twig template in drupal 8, I followed "Create custom twig templates for custom module" from their website but it's not working for me for some reason. This is what I have: ...
1
vote
1answer
50 views

Entity reference view depending on other field [closed]

I have a custom content type that contains an entity reference field (field_referencefield) and one more field as select box (field_triggerfield). The values of field_referencefield should depend on ...
0
votes
1answer
32 views

Contextual filter using any term ID

I want to set up a view with a contextual filter that will work with any term id (without selecting a specific category). I could only find some old, dated mentions of this. So I'm not sure if this is ...
0
votes
0answers
28 views

Replace taxonomy vocubulary administration page with a view

I would like to replace admin/structure/taxonomy/manage/my_vocabulary/overview with a custom view. Some of my vocabularies have custom fields that I would like to display and use as filter for the ...
4
votes
1answer
72 views

How to get a section of the menu tree based on the current node?

I am currently struggling to wrap my head around how the menu tree and menu link services work for outputting part of a menu with some custom requirements. Admittedly I don't have to do this very ...