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
-1
votes
0answers
4 views

Subtheme not identical to original after creation

I installed bootstrap4 theme and I created a subtheme using bootstrap4 appearance configuration menu. When I activate bootstrap4 theme, I have a visible header and footer background color. When I ...
0
votes
1answer
40 views

Using Twig in global custom text to check for a specific content type

I am filtering for two content types to display in a view: Artwork Page and Cover Page. I want to change the HTML markup for Cover Page. I have researched and tried many field names for Content Type, ...
-2
votes
0answers
26 views

Passing variable through template

I have a paragraph where I display a bootstrap slider. So I have a loop to display each slide {% set slides = content.field_slides|indexed_array %} {% for key, slide in slides %} <div class=&...
0
votes
1answer
43 views

Twig template for just one page in a view

I have a Drupal view (Product Section) where I have a master view. This is the view I'm currently using for Computers, Cell Phone, and other pages I am still creating. I also have a Product Shop page,...
0
votes
2answers
17 views

Unable to check if variable is empty in views twig

I am trying to overwrite views-view-unformatted.html.twig file and want to check if title variable is empty or not, but whatever I do, it always acts just like it is not empty. I know title variable ...
2
votes
1answer
32 views

How to verify if a custom logo is used?

How can I check whether the site is using the default theme logo or a custom logo? When I use the Twig debug tools to dump the site_logo variable, I only get the path of the logo, which doesn't tell ...
3
votes
1answer
150 views

Can we add custom CSS class in \Drupal::messenger()->addStatus()?

I did some research regarding adding custom CSS classes in the message but could not find the actual solution. As per Drupal 9 documentation: \Drupal::messenger()->addMessage(t($message)); public ...
0
votes
1answer
29 views

How to make a vertical menu properly?

Good morning all, Today I would like to ask a simple question about the menus. How do you make a clean sidebar that takes up the entire length of the page? In general, the themes offer only natively ...
0
votes
0answers
40 views

How to receive menu items in Twig template as array/object?

I need to receive (for example by menu machine name) and operate menu items data to use it in Drupal Twig template like: <ul> {% for item in items %} <li><a href="{{ item.url }}...
1
vote
1answer
71 views

How can I customize the 403 page for specific routes?

On a D9 site, with an existing custom 403 page twig. I've been requested to show a different, variable, message from the "standard one" for a couple of specific routes. I've tried with ...
0
votes
0answers
35 views

Can't hide website html on the /user/login path [closed]

I'm a newbie with Drupal, using v8.9.16. I've created a simple theme with html.html.twig, page.html.twig and page--user.html.twig files in the /templates folder of the theme. Now I'm trying to display ...
0
votes
0answers
16 views

Advagg with S3fs relative url() references inside of CSS files - broken image URL

Background Images Paths are Changed when CSS Aggregation is On s3fs module with AdvAgg to store CSS/JS aggregates on the S3 stream wrapper Without Aggregation (Works well). fetch from domain base url. ...
0
votes
0answers
68 views

Add additional taxonomy term fields to an exposed filter form

Brief: How to add a custom field from a taxonomy term into a View's exposed filter form? Specific: I have an image field added to taxonomy terms that I want to add to the exposed filter form along ...
0
votes
0answers
38 views

How to display images from the media library on paragraphs that belong to a body-type field

I'm only able to display text from a body field. How do I display images from the media library? This is what I tried, but it doesn't work. Thanks in advance! {% block paragraph %} {% autoescape ...
0
votes
0answers
47 views

Why is the region content already rendered as markup?

I'm attempting to craft some custom layout HTML in one region of my theme (uswds_base, but this doesn't appear to be theme specific). The content of a typical region.html.twig file is like the ...
-1
votes
1answer
29 views

Unable to pull image inside twig file [duplicate]

I am trying to show image via view twig file and below is my lin eof code: <img width="220" height="112" src="{{ file_url(content.field_thumbnail_new[key]['#item'].entity....
1
vote
0answers
13 views

Trying to remove drag widget from custom fieldwidget [closed]

Is there a hook I can use on a field widget to remove the drag widgets from multi value fields? I made a custom field widget that accepts multiple items, but it should never be sortable. There is a ...
1
vote
1answer
60 views

What is the new methodology for Form Pre-Render in order to utilize TrustedCallbackInterface

We are upgrading our sites one at a time from Drupal 8 to Drupal 9 and there is one line of code in our custom theme that is the last of our problems. We get the following error on View that uses an ...
2
votes
1answer
66 views

is it possible to deactive twig cache for a single theme custom template?

i am having a custom template for rendering a medialink url from a paragraph media entity ref field. In production with twig cache activated, modifiying the media attached file , does not update the ...
1
vote
1answer
39 views

How can I print the Layout builder in a node twig template?

After enabling Layout builder for Page content. I can see in Manage fields, a new field called layout_builder__layout. I want to print this inside node--page twig template. This should work but it ...
1
vote
0answers
16 views

Custom admin theme showing links in backend from frontend

So im new to drupal and i'm learning on how to use custom theme's by reading theming drupal. There is a topic about sub theming and I thought it was interesting to make a sub theme from the default ...
0
votes
1answer
39 views

Using template variations from the modules folder

I have the usual theming solution for a custom entity: function module_theme($existing, $type, $theme, $path) { return [ 'customentity' => [ 'render element' => 'elements', '...
2
votes
1answer
41 views

Making custom template & variables in module

I am working with D8, and don't usually do themeing, so I am stuck on a problem. I have a custom route in a custom module that calls a method checkinConfirmation() on a controller. Inside that ...
1
vote
1answer
51 views

Private file not being displayed on Twig template

I am trying to get an image from the private folder to display on a printer-friendly Twig template page. The private folder is inaccessible to browsers and the only display method I know of is to load ...
0
votes
2answers
63 views

Pass current langage to twig on custom blocks

my custom module block, with supposely no cache <?php namespace Drupal\amu_social_icon\Plugin\Block; use Drupal\Core\Block\BlockBase; /** * Provides a 'Icon' Block * * @Block( * id = "...
1
vote
1answer
82 views

Somehow subscribe/react to addMessage

I'm trying to find an event that I can subscribe to for the method addMessage. I need to trigger some code everytime a status message is added. On reacting to this event, I need to send a variable ...
0
votes
1answer
37 views

undefined drupal_add_js function inside themename_preprocess_page

I wanted to use javascript to delete an option from the list of options in case the user is not an administrator and I searched and found this code inside a post and I used it inside the project's ...
0
votes
1answer
33 views

How can I make Barrio SASS gulpfile coninue watching for changes

When running gulp. It runs and compiles SASS one time. How can I adjust the watch so that it continues watching for changes. Do I need to add usePolling: true or usegulp.series. I am following the ...
0
votes
0answers
12 views

Drupal 7 taxonomy term fields not handling content filters

Image Resize Filter doesn't work with taxonomy term description. Resizing works fine in nodes and blocks, but not in views for taxonomy term. I'm loading term in my view template. And render its ...
0
votes
0answers
15 views

Output of Twig truncated field value sanitezes punctuation characters

I output the text of a field in a twig template truncated to 160 characters like: {% set text = content.field_text.0|render|striptags %} {{ text|length > 160 ? text|slice(0, 160) ~ '...' : text }} ...
1
vote
2answers
85 views

Can't set custom document title in theme-settings.php

I'm a newbie with Drupal, so I'm not sure I do everything correctly. I need to set custom document title (i.e. between <title> and </title>), not in a module, but in another PHP file for ...
0
votes
0answers
11 views

Old GZ file is generated after editing CSS original

After editing CSS file in the /sites/default/files/css directory I removed its GZ version and it's generated after a while, but with old CSS code. How to edit CSS correctly? And how to force ...
0
votes
0answers
8 views

Override/remove title of view with contextual filter as a block

I have a block in a page that is a view with a contextual filter. As a block does not have a path, I have to provide a default value "raw value from URL" as per Contextual filter with a ...
-1
votes
1answer
63 views

Get the value of a field to do an if statement Twig

I am trying to generate a PDF with Entity Print. Until then all is well. In my Twig page, I try to make conditional displays. But I can’t get the conditions to work. I render my fields using {{ ...
1
vote
0answers
33 views

How can I customize breakpoints in USWDS base theme?

I'm using the USWDS_base theme as a base for my custom theme. Version 8.x-2.10 In this file: web/themes/custom/my_child_theme/sass/_uswds-theme-utilities.scss I find the tokens used for the ...
0
votes
0answers
36 views

How to add index to paragraph template

I want to use paragraphs to implement a carousel, and for now, I have the outer paragraph called slideshow, and the template is paragraph--slideshow.html.twig. Then, inside this paragraph, I can add ...
0
votes
0answers
25 views

How to remove home in a breadcrumb from a specific page in easy breadcrumbs and add carets for the breadcrumbs?

I've been using the easy breadcrumb module in Drupal 8, I enabled the option - "Include the front page as a segment in the breadcrumb" for all pages, but there are few pages for instance /...
1
vote
0answers
19 views

Webform token won't render value in iframe

I have an iframe in which I'm trying to include a token which is a value from a select list. In the code below, this value: [webform_submission:values:choose_video:raw] Won't render in the iframe, ...
0
votes
0answers
14 views

How to change form-text field maxlength / Translatation field?

I would like to increase maxlength of translation field. In database, field is VARCHAR (255) For translation version : maxlength = 128 I dont'know how to change maxlength for translation version. Is ...
-1
votes
2answers
55 views

How can I get the current URL including all query paramters as a string in a template?

I am trying to get a URL including all parameters as a string in a Twig template but I'm unable to achieve that in Twig. Is there a way we can get the url include parameter as string in Drupal 8? I ...
0
votes
0answers
33 views

Twig sets body class even when region is not rendered in DOM

In the html.html.twig file of my theme if added the following code to body_classes to add a body class if a region is not empty: page.hero ? 'w-hero-bg', So it looks like this: {% set body_classes ...
-1
votes
1answer
18 views

How to add anchor to a single block displayed on specific pages within the same page?

I have a basic layout for a Drupal 8 site, created two blocks with block 1 containing menu with static content and links to pages, and block 2 for subscription form, The block 1 and block 2 are called ...
0
votes
0answers
24 views

How do I create and call a custom named function? [duplicate]

Brand new to Drupal and I need to figure out how to create a custom function and call the custom function in the twig file. I need to build a news releases function that reads a directory and pulls ...
0
votes
0answers
19 views

File for template suggestion not picked up

I am using suggestions for a node , I have in the html source the suggestions: node--1.html.twig, node--1--article-list.html.twig, node--article-list.html.twig, and node.html.twig Whenever I use ...
0
votes
1answer
17 views

How can I add classes to rows depending on the loop index?

I have received a design where they want to have the latest three articles links put on the top of the front page (over their respective images) so that the first is taking left half of the page and ...
0
votes
0answers
58 views

Why is my template suggestion not called (the return)?

I have seen many questions like this ones and I have tried all the solutions... Here is my setup: 1-I have a custom entity with the id defined as follow: * @ContentEntityType( * id = "...
0
votes
1answer
31 views

Escaping CSS digits, 0 is removed from CSS aggregated files

The following HTML markup won't work on a production site. <div class="iconleft 109">TEXT</div> This is the code in the custom.css file. .iconleft.\31 09, .iconleft.\31 12, ....
1
vote
2answers
38 views

How do I add a <div> over a paragraph's field, depending on another field of this paragraph?

I have a paragraph (from the paragraphs module) which has two fields : field_title (text) field_title_level (list text) The field_title_level can have either h2, h3, or h4 as a value. What I would ...
-1
votes
1answer
24 views

Breadcrumbs not appearing

I have a custom theme extending the bootstrap theme. In my theme there are no extra files except the .info.yml file. Everything else is inherited from bootstrap. I have also kept the regions in my ...
0
votes
0answers
19 views

How to rewrite a Views RSS?

The RSS Views Feeds are very restricted. I created an RSS Views Feed to display the Message (https://www.drupal.org/project/message). I want to rewrite the RSS Views Feed and I want to display the RSS ...

1
2 3 4 5
210