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
0 answers
15 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
24 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
  • 333
0 votes
0 answers
13 views

Prevent text selection for embedded PDF [closed]

I have in a twig file with this line of code : <object type="application/pdf" data="{{content.field_media_file.0}}#toolbar=0" class="h-[700px] m-auto w-full">{{ ...
Pedro's user avatar
  • 51
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
31 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
  • 893
2 votes
1 answer
46 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
49 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
20 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
53 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
42 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
51 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
14 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
182 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
  • 755
0 votes
0 answers
28 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
43 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
104 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
  • 893
0 votes
1 answer
69 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
74 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,500
-2 votes
1 answer
109 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,193
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
79 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
55 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
100 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
50 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
263 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
42 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
63 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
40 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
118 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
53 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
76 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
82 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
71 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,500
0 votes
0 answers
74 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
335 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
97 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
82 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
144 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
0 votes
1 answer
58 views

How to hide a region in a node (most preferably without a module)?

I want to hide the sidebar region only in my homepage. CSS display:none for the sidebar region is not enough because main content won't expand to cover the actual region so I think about using a ...
fuzzy_designer's user avatar
0 votes
0 answers
58 views

View breaks the page output

Has anyone encountered this problem or can at least help me debug it? The views is displayed as standard if the parameters are specified. Format:Unformatted list | Settings Show:Field If I change it ...
drupnub's user avatar
0 votes
1 answer
65 views

Image field and links not showing in view block template

I have a CT team_members with the following fields. field_team_member_image field_team_member_name field_member_designation field_social_media_links(Multiple values with links to twitter, instagram,...
KTM's user avatar
  • 2,372
-4 votes
1 answer
67 views

building a subtheme using stark as the base theme but getting this error in the info.yml

i keep getting this error. The error goes away when i remove the info.yml file from the subtheme. I upload the subtheme in the root theme directory. I've added the error message along with the info....
beauthis6's user avatar
1 vote
1 answer
40 views

How can I get the numeric ID for a block from within the block template or hook_preprocess_block?

How can I get the numeric ID for a block from within the block template or hook_preprocess_block(). By numeric ID, I mean the ID that we see in the edit link for a block. For example, mysite.com/...
arnoldbird's user avatar
  • 1,193
0 votes
1 answer
74 views

file_url() produces no output [duplicate]

I have a custom block, and a block--inline-block--hero-video.html.twig template file. The block has a field_video field. If I put {{content.field_video[0]}} in my theme, the output is the following (...
alberto56's user avatar
  • 214
1 vote
2 answers
396 views

Why can't I disable CSS caching?

Background I am developing a custom theme for my Drupal 10 site. I found myself constantly flushing the cache, so I have been looking up ways to disable the cache on my local dev site. My end goal is ...
GeorgeCiesinski's user avatar

1
2 3 4 5
216