Questions tagged [theming]

Use it for questions about rendering or modifying the HTML markup produced by a module/theme.

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

How can I change the tab.id of Tabs

So I need to be able to change the tab-id of tabs because currently, when a tab is created it is assigned some kind of id. This id is put into the anchor (like an id=# tab.id) in my twig file tabs....
0
votes
1answer
25 views

How to count number of published nodes of a specific content type in twig template?

I'm looking for a way to achieve this in my Twig file; if the number of published entities of a content type 'promotions' is at least one, a certain entity should be displayed in a content type Shop. ...
0
votes
0answers
25 views

How to put a condition in TWIG “if the user is flagged”?

I have a site with Drupal 8 and the Flag module. I would like to display a text when the user has the association role and when it is flagged with the following flag (his machine name): ...
2
votes
0answers
31 views

Differences in adding classes to nodes and paragraphs

I'm trying to add some classes to a certain content type. In mytheme_preprocess_node_contentype() I'm able to use $variables['attributes']->addClass('myclass') However, in ...
-1
votes
0answers
15 views

Override Google Font inclusion in child-teme [duplicate]

i'm using Drupal 8.9.6 and create mytheme as child-theme of Hawell. In hawell.libraries.yml i have global-styling: version: VERSION css: theme: css/bootstrap.min.css: {} ...
1
vote
1answer
35 views

Webform Status in Webform Submission Twig Template

I'd like to use the current open/closed status of a webform in a conditional on the webform-submission-information.html.twig. There is a "webform" variable available to use in the ...
0
votes
1answer
21 views

How can I use #tags in pager_default_initialize()?

I want different label for first/last/next/previous button in the custom navigation using pager_default_initialize(). How I can set an array that can change the button label. $total_count =9999; $...
0
votes
0answers
34 views

How can I show/hide node field values the same way items are shown/hidden in /admin/modules?

When viewing a node of a specific type, how can I show/hide the values like in /admin/modules? I want to be able to click on the field title and show or hide the value. Is there a module that can help ...
0
votes
0answers
40 views

How to display the rendered entity of a store in a code?

I created a custom module for Drupal 8 and Drupal Commerce. It is used to display a link "Accept the conditions of sale" in the purchase funnel during an order. This link displays a modal ...
0
votes
1answer
19 views

Override of commerce-order-receipt.html.twig template not working?

My theme is using Bootstrap barrio theme (bootstrap_barrio) as a base theme. I'm trying to override Drupal commerce template modules/contrib/commerce/modules/order/templates/commerce-order-receipt....
-1
votes
1answer
31 views

Custom block theme not appearing in QuickTabs content

I'm attempting to create a dashboard page that contains 4 tabs that are each a block that will contain a content based on the current user. I went ahead and created the 4 blocks (bl1, bl2, bl3, and ...
0
votes
0answers
41 views

How to get taxonomy term reference fields value translated in twig

I have a taxonomy vocabulary with terms. In a content type, I have a referenced field with this taxonomy. I can get the taxonomy term in twig like this : {% for item in node.field_lorem %} {{ ...
0
votes
0answers
24 views

How do I inject CSS classes to a rendered field with a view style?

I maintain a module that provides several views styles. I have been unable to figure out how to get the fields where a users custom css entered in the views UI is then output with the view when I have ...
0
votes
1answer
36 views

Count multivalue image field values in views-view-fields.html.twig

Making a presentation template for the gallery. The photo gallery has an image field with multiple values. I need to output the number of gallery photos (in the field_gallery_photo). How do I do this? ...
0
votes
1answer
29 views

How to retrieve view row attributes when in twig template

I am using addClass() in hook_preprocess_views_view_unformatted (see my question regarding this at here), and the class is added to each row, but the next stop for the view results is views_view.html....
0
votes
1answer
21 views

Favicon settings missing on subtheme config

Using Drupal 8 W3CSS Theme 8.x-1.17, I created a subtheme. The subtheme works fine, but on the settings page, the entire #edit-favicon div is hidden; style="display: none" has been added. I ...
1
vote
1answer
21 views

Using hook_preprocess_views_view_unformatted properly

I have the following hook in mymodule.module function mymodule_preprocess_views_view_unformatted(&$variables) { $view = $variables['view']; $rows = $variables['rows']; if (in_array($view-&...
0
votes
0answers
18 views

Override fieldset.html.twig

I am having some trouble understanding the concept of overriding twig templates. I have turned on debugging mode and most of the time I see overriding suggested file names like this: <!-- FILE NAME ...
0
votes
0answers
18 views

Center concatenated fields in theme table

In the attached image I have two similar tables. The first one was created using views, the second one is the table I'm creating with my own module. My question is: How can I center the information in ...
0
votes
1answer
23 views

Change data export download link label

I want to change the label shown to export csv file download link that generated with data export of a view. I didn't get any setting to change the label of download link - download full list.
1
vote
0answers
18 views

create a class from taxonomy to wrap image and caption field

I have a content type called events. I created an image media type reference field called speaker image and set it to unlimited. Within my media image type, I've created two custom fields, a text ...
-2
votes
0answers
35 views

Send requests to module instead of theme

I have developed a custom module for my decoupled site to fetch information using the Drupal API and return it as JSON. I did not use the JSON API module because I would have to do a lot of ...
0
votes
0answers
11 views

How to print views exposed filter among the fields?

I have a view, having an exposed filter and a few fields. I am using the twig template of the view to show the result for the design purposes. I need the expose filter among the fields. Eg. Name: Khan ...
0
votes
1answer
27 views

How can I load a custom twig template depending on a view mode?

Currently I have the following code in my module file: function mymodule_theme_suggestions_credit_report(array $variables) { return [ 'pdf_report__' . $variables['elements']['#view_mode'] ]; } ...
0
votes
1answer
32 views

Using twig, how to show a message on the frontend if a field is empty?

Using twig, I would like to show a message on the frontend if a field is empty. My question refers to a date field, but I think this question could apply to other field types. In my event content type ...
0
votes
0answers
26 views

How can I use the grouped nid in a views template with two content types?

In Drupal 8.9x, I have a view with two content types in it: Each business (and its details are grouped), and underneath each business I'm displaying multiple offers by that business...and then I want ...
0
votes
0answers
21 views

bootstrap_barrio subtheme breaks ckeditor's media insert in custom block in node layout builder

I'm facing this problem (seems to be producible) in a contrib theme that breaks the ckeditor media insert button on custom blocks in the layout builder of individual nodes... The javascript error says ...
0
votes
1answer
24 views

Change Link URL in preprocess function

I need to slightly modify some URLs that are in a "Link" field on a custom entity type. In a mytheme_preprocess_myentity I've found that field with $variables['elements']['field_my_url'][0] ...
0
votes
0answers
14 views

Modify variables set in parent's theme template using preprocess functions

i am having this theme parent's template field--paragraph--field-accordion-items.html.twig : {% set block_classes = [ 'flex-container', 'flex-child-auto', ] %} {% if element['#object']....
0
votes
1answer
17 views

Have a child node inherit taxonomy from a parent during /node/add?

In Drupal 7, I have two content types: Parent Events with tags (like "outdoors" or "popular" or "suitable for kids"). "Tags" are taxonomy terms in a vocabulary,...
0
votes
0answers
17 views

How to properly configure the Mega menu module?

first of all I would like to point out that I speak very poor English, sorry in advance for the poor quality of the translations... (Google Translate) I recently encountered several problems with the ...
0
votes
0answers
21 views

Passing variable data into scss from twig

Is it possible to pass variable data from twig into css, like is done in this non drupal related question. The accepted answer suggests it's possible. My Drupal project uses data from image fields to ...
0
votes
1answer
42 views

How do I render search block form in theme template?

I've customized the search block in "block--search-form-block.html.twig" and it works using block layout on Drupal 9. Is it possible to render the Search Block directly in page.html.twig? I'...
0
votes
0answers
22 views

Avoid the “form-text” class is added

Drupal 7 adds the form-text class to my input fields, which messes with the layout from my custom Bootstrap-derived theme. How can I strip these out? I tried with hook_form_alter(), but the form-text ...
0
votes
2answers
35 views

How do I add a template suggestion for a Views block?

I am very much so new to Drupal and have moved to this platform after working with Magento for 5 years. I am trying to create a template for a view. I have created the twig template under /templates/...
1
vote
1answer
21 views

How to Reload a Custom Drupal Theme (Without the Command Line)

How do I reliably reload a custom Drupal theme I am developing without access to the command line? Just clearing the caches before I perform the load only works sometimes. FWIW, we are promised ...
0
votes
0answers
14 views

Display nested form from module

I'm trying to display my nested form in my twig template. But I can find how to display the subchilds values (not the input, the value). As the tree form item is like this, I don't no how to loop over ...
1
vote
1answer
26 views

How to add an additional class to each element in the menu-local-task.html.twig template?

I need to change the admin tab template by adding my wrapper and class to it. This is the default code: <li{{ attributes.addClass(is_active ? 'is-active') }}>{{ link }}</li> My code: <...
0
votes
0answers
28 views

How do you get the current destination URL query parameter in Twig?

Does anyone know to how to get the drupal destination in twig file? At the moment I an getting the destination parameters in a preprocess function. // Get destination params. $variables['...
1
vote
1answer
23 views

Form in modal dialog: Template suggestions have weird random suffix

My custom module has the following form route in mymodule.routing.yml: library_assets.add_asset_to_slideshow_modal: path: 'library/add-to-slideshow-modal/{library_asset_nid}' defaults: _form: ...
0
votes
1answer
23 views

Accessing text field with multiple values in a twig file

Here is my use case: I have a content type which has a field referencing multiple other entities. Those entities have a text field with multiple values. So I do {% for ref in node.field_references %} ...
0
votes
0answers
36 views

I cannot make the paragraph preprocess work at all

I have a Barrio-based subtheme and I am rewriting from scratch an old Drupal 7 site to be moved to Drupal 9 (my first Drupal 9 site). All pages in the new site is built by different paragraphs and ...
0
votes
1answer
35 views

Preprocessed var not being passed to twig template

I created a custom theme called wdocs as a sub theme of d8w3css. I made a template to override the menu template for the user account menu, calling it menu--account.html.twig. For my theme, I added ...
1
vote
1answer
23 views

How to get instance of Module / Plugin / Widget of Vote Object in THEME_preprocess_node? [closed]

My drupal site is using the Fivestar Module or from the Vote Up Down Module. Multiple of my content types are using various implementations of these as fields (specifically comments and my primary ...
1
vote
1answer
29 views

How to print “node title” in comment.html.twig template?

i am styling my comments in comment.html.twig template and need to show "node title" of the node to which the comments belong. I've tried a number of options, and the only one that works ...
0
votes
1answer
29 views

How do I get the video media path in a theme?

I want to embed a video on a page. How do I display the field_media_video_embed_field in my twig? The complicated thing about this is that I am using a view inside tabs. {{ kint(programme.video) }} ...
0
votes
1answer
29 views

Webform Custom Radios/Checkboxes Element does not get rendered in webform : Drupal 8

I've tried to create custom Webform elements of type radios and checkboxes. The element is available in the Webform UI for admin, I can add it to my webforms from build section but it is not getting ...
0
votes
2answers
30 views

Assign unique IDs to HTML elements via twig file [duplicate]

I have a "block--system-menu-block.html.twig" file, which prints the menu content into the menu. {# Menu. #} {% block content %} {{ content }} {% endblock %} However, I would like each ...
1
vote
1answer
36 views

Override user login form template

I'm trying to customize my user login page in my custom theme using the template file page--user--login.html.twig, but am having issues accessing the different form elements. All aspects of the form ...
0
votes
0answers
26 views

How to add the Group Role as body class in the page template

I like to add the Group Role of the currently logged in user to the body class of the page twig template. So this is not the same as the user roles the user account has. Currently using Drupal 9.0.3. ...

1
2 3 4 5
208