Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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

Display membership card in empty window

Wow, feeling stupid right now. I need to display some membership details and a QR code in an otherwise empty window - so that the user can print it. How do I force a page not to have all the branding, ...
Adaddinsane's user avatar
-2 votes
1 answer
36 views

contextual menu module - error 400 on URL /contextual/render break contextual links on a limited number of pages

on a fully developed drupal, some contributors noticed me that the contextual menu links are broken on a limited set on pages. After a quick check i see that all those pages have a broken XHR request ...
SupFrig's user avatar
  • 109
0 votes
1 answer
49 views

How to render a link to a page fragment in Twig

I have a Twig template that prints a link with the following code: {{ link(item.title, item.url) }} This code is rendered as an a element with a href attribute similar with the following: https://www....
quilx's user avatar
  • 19
0 votes
1 answer
25 views

Passing data to a field formatter via views with referenced fields?

In creating a 'traffic light' field formatter, how to access views data stored in an entity 2 levels up? The traffic light is 'green' if speed is 'good'. There is a radar entity which has the location ...
Interlated's user avatar
  • 1,423
3 votes
1 answer
72 views

How can I add a template suggestion for a field formatter based on the current view mode?

In my Drupal 10 theme how I can get Entity View Mode? I use this to rewrite suggestions /** * Implements hook_theme_suggestions_HOOK_alter(). */ function ...
Aleksandr's user avatar
0 votes
0 answers
31 views

How can I theme the blocks different with the same classes?

I have several blocks here that I would like to design differently, one contains text and the other a picture. Unfortunately, the css classes are the same and I can't use the ID because it is always ...
Bavramor's user avatar
1 vote
0 answers
29 views

Add machine-name as css class to my blocks

So I would like to give my blocks the internal machine name of the block as a CSS class? I can add the block ID and the block type as presprocess via theme.theme: function xxx_theme_preprocess_block(&...
Bavramor's user avatar
0 votes
0 answers
54 views

Styling a "programmatically created block" in drupal 10

I'm new to Drupal dev, I'm messing around creating some custom modules and explore how the env of drupal 10 works... I've created a custom block that i called "Copyright": <?php declare(...
tsukingo's user avatar
0 votes
0 answers
60 views

Unable to render HTML in a view

I have a view that includes HTML from a rich text field. Im trying to render the HTML in a twig template but it does not work. Tried {{ output | raw }} also autoescape. Here's how it looks in the ...
Tony Horrocks's user avatar
1 vote
1 answer
39 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
46 views

Can't pass variables from a controller to the template if I use base hook to override the theme template

I've created a custom route that uses a controller to use a custom template. If I don't mess with base hook my template is rendered somewhere inside page.html.twig as a block and all the variables are ...
Andrei's user avatar
  • 15
0 votes
0 answers
39 views

What is the valid value for Webform element type in form-element.html.twig?

I'm currently attempting to rewrite the form-element.html.twig to incorporate custom CSS based on the label display and field type for Webform element output. While I've successfully identified ...
CocoSkin's user avatar
  • 891
2 votes
1 answer
51 views

Custom theme throws “Undefined constant "CSS_STYLE" in constant”

I just built a custom theme for Drupal 10. When enabling it via /admin/appearance, the dreaded message “The website encountered an unexpected error. Try again later.“ appears. drush watchdog:show says:...
Wolfgang Schardt's user avatar
1 vote
1 answer
53 views

How to generate content based on data in nested child render elements?

Motivation I am trying to build a "table of contents" / "In-page navigation" block, that should extract labels and ids from block render elements within a theme region. E.g. a ...
donquixote's user avatar
  • 3,642
1 vote
0 answers
24 views

How to provide theme suggestions based on display mode of media for file video

I want to have a seperate template for Video Media Field to have a play icon on the center of the video. But the file video template doesn't have a suggestion based on Media Video view mode. I tried ...
Zuhair's user avatar
  • 286
-2 votes
1 answer
53 views

Can I put taxonomy tags in a block and if I can, how to prevent them from appearing in a field of a node?

Having the taxonomy tags in a field of a node in the main content block of the Content region, is a problem for me, as I would prefer having them inside a block so to better choose where they appear. ...
heya's user avatar
  • 1
0 votes
1 answer
58 views

How to add at least one CSS class to a twig region?

I am trying to add CSS classes to a new region {{ page.example }} in page.html.twig In the start of page.html.twig, I have added a set of CSS classes: {% set classes = [ 'region--content', 'grid-...
osi's user avatar
  • 1
0 votes
1 answer
43 views

Add fields to content-type when Theme is enabled

Is there any way we can change configuration items when we switch to a specific theme? Our (simplified) situation: Using Drupal 10.2 Our customers can choose between different themes Every theme uses ...
mullzk's user avatar
  • 65
0 votes
1 answer
52 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
0 answers
15 views

Theme Drupal comment reply page exactly like comment submitted page

I have created a custom content type 'article' where a custom comment field has been added along with other fields like images, taxonomy terms, etc. In the theme file (page.html.twig) for this content ...
shinkula's user avatar
0 votes
1 answer
752 views

How to force the browser to refresh the CSS/JS files

I've made a small change on a view (added a new class) and some related changes in the CSS files of the theme. Since the config change (HTML output) is immediately in effect, I need the browser to be ...
s427's user avatar
  • 735
0 votes
0 answers
29 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
44 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
0 answers
28 views

Overriden Book Navigation template is not showing for anonymous user

On Drupal 10, I have copied and modified the book-navigation.html.twig file to my custom subtheme "templates" folder (/themes/custom/my_subtheme/templates/book-navigation.html.twig). This ...
Clément BK's user avatar
0 votes
2 answers
110 views

How do I get the image URL with the same style setting in Manage Display?

I'm creating a paragraph template. It renders images and other fields to create a layout design. While I can successfully render all fields, the challenge is to render the style applied in the Manage ...
CocoSkin's user avatar
  • 891
0 votes
1 answer
73 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
1 answer
78 views

How to disable ampersand encoding in {{ attributes }}

Is it possible to disable the ampersand encoding when rendering <div {{ attributes }}> in a hook (preferred) or Twig? Background: Drupal by default escapes ampersands & into &amp;. This ...
Hudri's user avatar
  • 5,530
-2 votes
1 answer
121 views

Is there a Drupal way to make a menu horizontal and responsive and leveled (similar in style and behavior to a main navigation menu)? [closed]

I have added a menu to a block in a full width region but my problem is that this menu appears vertical and I didn't find a way in Drupal to make it horizontal, similar in style and behavior to a main ...
drupaler's user avatar
1 vote
0 answers
50 views

Is it possible, with Twig Tweak or any other means, to place a menu block in a specific language?

I want to place a menu block in a template, but ensure it is always displayed in a specific language regardless of whether the content node where it appears is in that language. I do not ever want ...
arnoldbird's user avatar
  • 1,213
0 votes
1 answer
35 views

How to switch template for search results without using views and display modes?

I want to show my Drupal 10 Solr search results in either grid view or list view. I set this up using Views and Display Modes, and I have icons on the page which simply link to the URLs of the ...
Lemmy's user avatar
  • 201
-1 votes
1 answer
81 views

Sidebars don't appear

I am trying to add two sidebar regions, sidebar_first and sidebar_second, one region on top the other region. Both regions should share the CSS styling from sidebar region but my problem is that both ...
alesios's user avatar
  • 41
0 votes
1 answer
60 views

How can I get a printable version of a node?

I have a node with a simple article in it (an <H1>, a bit of <H2>s and some <p>s). If I print this page from the web browser as-is, I will get it with grandiose spacings, Drupal ...
alesios's user avatar
  • 41
2 votes
1 answer
111 views

What is the purpose of the Stark theme?

Claro is for administration, Olivero is general, but what is Stark for? An intentionally plain theme with no styling to demonstrate default Drupal’s HTML and CSS. Learn how to build a custom theme ...
alesios's user avatar
  • 41
0 votes
1 answer
69 views

Subtheme update

An update has become available for a given theme (Bootstrap Barrio). I had configured the previous release into a subtheme. How can I update the subtheme, or at least make a new subtheme of the ...
user42221's user avatar
2 votes
1 answer
267 views

How to correctly create and edit left to right pages in a right to left website?

I have a website in Hebrew, a language written from right to left (RTL). Hebrew is used for the administration interface and for the general interface; generally pages are in Hebrew for all users. I ...
jorno's user avatar
  • 43
1 vote
1 answer
47 views

How can I use material symbols in the search bar submit input?

Background I have a Drupal 10 site with a search bar that appears on the front page. Using this search bar redirects the user to a search page with a similar search bar, underneath which are the ...
GeorgeCiesinski's user avatar
0 votes
1 answer
75 views

Chosen dropdown in Claro subtheme

I created a subtheme for Claro theme in drupal 10. Before adding any custom code, I expected it to not be different from the parent theme, but the chosen dropdowns are off. (first pic - claro, second -...
user7167081's user avatar
1 vote
0 answers
60 views

Modifying a field value in theme_preprocess_node()

I have a content type (exercises) which contains a text field (field_path). In this text field I have a path to a video file. I would like to retrieve the value of this field in theme_preprocess_node ...
HEIA Drupal's user avatar
0 votes
1 answer
41 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
-5 votes
1 answer
124 views

How to make CSS changes without the need to flush all caches after each CSS change?

Core version 10.1.6 with an Olivero based sub-theme with a style.css file. My problem is that CSS changes I make in style.css won't take effect until I flush all caches and this causes me to lose much ...
ali's user avatar
  • 3
-2 votes
1 answer
57 views

Is it possible to make a theme hook suggestion for blocks according to content type?

I was hoping it was possible to do something similar to this for menus: * Implementation of hook_theme_suggestions_HOOK_alter() for menus. * * Make menus themeable: * e.g. => menu--main--node-...
huijing's user avatar
  • 209
0 votes
1 answer
104 views

Event listener for button intermittently fails to be added on home page

Background I have a filtered view for the content type "Change Requests" that I built as a page, and as a block. The block is added to the user's home page and only shows that user's change ...
GeorgeCiesinski's user avatar
-2 votes
1 answer
58 views

How can I hide a specific region according to its url?

I need to hide the footer region on all pages with whose URL contains /people/, similarly to what is possible to do with blocks.
Yohan's user avatar
  • 1
0 votes
2 answers
91 views

How do I change the input type created by views daterange filter?

I am using a view created with the views module. The view displays all change requests, and I wanted to expose a filter to users to be able to filter the change requests by date. The change requests ...
GeorgeCiesinski's user avatar
1 vote
0 answers
74 views

How to prevent HTML entity encoding in Drupal attribute objects?

Is there an easy way to disable the HTML entity encoding of CSS class names? When I create CSS classes with ampersands or the "larger than" symbol (which might look strange but is ...
Hudri's user avatar
  • 5,530
0 votes
0 answers
94 views

How do I style the tooltip that displays element title on hover?

Background I am building a custom Drupal theme for my site. For the most part, the styling is pretty straight forward, but I am struggling to find what js or css controls what appears to be a tooltip ...
GeorgeCiesinski's user avatar
1 vote
1 answer
381 views

Upgrade to Drupal 10.1.6, Theme Doesn't Load Outside Maintenance Mode

I'm working to upgrade a site from 9.5.11 to 10.1.6. I followed the instructions provided here: https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-...
Scott Hollenbeck's user avatar
0 votes
1 answer
111 views

How can I render only a region in a controller?

I'm looking to have a page on /templates/header which only renders what there is in the header region of the theme. I am using the following code for a custom controller. namespace Drupal\...
Victor Pudeyev's user avatar
0 votes
0 answers
83 views

I can't manage to render empty fields

I have a custom template file for List (text) fields. I need to display these fields using the Layout builder module. Everything works perfectly, until no value in those fields is selected. (The ...
Etzesty's user avatar
1 vote
1 answer
175 views

Stylesheets not loading

Has anyone successfully dealt with this kind of error? [Error] Did not parse stylesheet at 'https://*****.***/core/assets/vendor/jquery.ui/themes/base/core.css?s2pf9q' because non CSS MIME types are ...
Cary Gordon's user avatar

1
2 3 4 5
216