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
25 views

How do I use the Twig variables of the stores in a custom module?

On my Drupal 8.9 site I have the Drupal Commerce module. I created a custom module to create new pages in the store path, which also uses its own template files. How do I the Twig variables of a store ...
0
votes
0answers
17 views

Theme a subscriber field in Simplenews issues

I need to address my subscribers in a more personal way. Thus I added fields for Mr./Mrs., firstname, lastname to the subscription block, and data gets collected nicely. However, I can't see how to ...
1
vote
1answer
24 views

Override page.html.twig with custom module template

I want to override the page.html.twig template from a custom module. I know how to create a suggestion, but I would like it to find the template file in my custom module. function ...
-4
votes
0answers
18 views

Styling listing page for taxonomy terms

I'm styling a listing page for content marked with a certain content keyword (taxonomy term). I already have a views-view-unformatted--taxonomy-term--content-keyword.html.twig file to display the ...
0
votes
1answer
45 views

Why is this if statement not working in twig?

It's a bidirectional D9 site where I removed dir=rtl from my theme's html.html.twig with an if statement and it's working fine. I did that to avoid an MS browsers bug ignoring position: sticky in css ...
0
votes
1answer
16 views

Hide block if no submenu in Twig

I'm creating a node--page.html.twig and I'm using twig_tweak to help render a block for my sidebar to display the sub-menus. Is there a way to hide it if the page doesn't have any submenus? Here's my ...
-3
votes
0answers
50 views

Manually coding a template to display multiple content items?

I want to create a nested grid that I can use to manually place content into for a responsive-style layout. Background: I've tried nesting Paragraphs which quickly became apparent would become a ...
0
votes
1answer
139 views

How can I prevent one template from displaying cached values?

I have a site with Drupal 8.9 and Twig Tweak. I created 7 view blocks to set up a task list in stores. I want to display a task counter for my current user on my home page. The tasks checks : If the ...
-3
votes
0answers
21 views

Why is the folder where the default bootstrap styles are missing?

I need to change some styles of header and footer in my bootstrap sub-theme. In developer's tools, I saw that the default styles for the header are in the my_project\themes\custom\bootstrap_subtheme\...
-5
votes
0answers
23 views

How to change background header and color of links in Bootstrap subtheme?

I created a subtheme based on the Bootstrap theme. In bootstrap_subtheme.libraries.yml writing such code: framework: css: theme: css/style.css: {} In bootstrap_subtheme.info.yml writing ...
0
votes
1answer
42 views

Twig template not rendering new field variable

I created a new field for a custom block type and have already exported necessary yml files and updated the yml for different view modes. However, when I make a reference to the new field using the ...
0
votes
0answers
14 views

Parent Theme overriding Subtheme on certain paths

I installed the Opgino installation for Drupal 8 and created a sub-theme for default theme that comes with Opigno. The subtheme works as it should, except on certain paths. Anything with a path of /...
0
votes
0answers
33 views

Add a template suggestion with highest-priority in custom module

It's easy to override an existing template in custom theme using one of the template suggestions or just by copying the desired template file and past it under custom theme templates directory. But ...
0
votes
0answers
8 views

How can I create the functionality to assign icon per field type in field settings form?

I would like add a new setting for field which would allow to choose a icon for a field same as cardinality or any other settings. /admin/structure/types/manage/[content_Type]/fields/field_[...
0
votes
0answers
32 views

How do I correctly sort merged arrays in a template file?

I have a content type in Drupal 8 with some fields referencing to taxonomy terms. I like to display these terms all together in one sorted array, so I merge the fields and sort them. But the result is ...
-3
votes
0answers
33 views

Problem with content placement

I've been making a theme for my Drupal site and I've stumbled into a problem. I'm trying to make it so i have 2 md-6 columns where i can put content and one big content region beneath. The only ...
-1
votes
0answers
27 views

Why does my theme only display the footer color?

I'm new to Drupal and creating my own theme based on Bootstrap barrio. Now i'm stuck with a problem: for some reason my theme will only display the color of my footer. I think that i have have defined ...
2
votes
1answer
36 views

How to render a text with linebreak saved from a textarea form?

Unfortunately I haven't found anything on the web with this specific problem. I have a field (text, formatted, long) and a form with a textarea element that should save the entered text to this field....
0
votes
1answer
18 views

Splitting field value inside field template not working?

I have a twig template for some text field. Inside it I'm displaying the value like (it's single value field): {% for item in items %} {{ item.content}} {% endfor %} And it's displaying value ...
0
votes
0answers
62 views

What to use instead of raw twig filter? [duplicate]

I created a field field_quantity_description that contains HTML code. I can output the escaped content of this field: {{ quantity.entity.field_quantity_description.value }} I want to render HTML ...
2
votes
1answer
82 views

Render private image on twig template

I have a content type with a private image field. I would like to render the image on the twig template in order to show it to the user when it has enough permission, but the image source is a private ...
0
votes
1answer
33 views

Why isn't my sub-theme using its CSS file?

I created a sub-theme of the Drupal8 W3CSS theme and followed their directions about copying and renaming files, and editing the info.yml file. I installed it, and set it as default theme. It works. (...
0
votes
0answers
26 views

Why isn't libraries-override with absolute paths removing assets?

I was trying unsuccessfully to override (and eliminate) table.css from the Boostrap Barrio theme. The pertinent lines from bootstrap_barrio.info.yml are: libraries: - bootstrap_barrio/global-...
1
vote
1answer
52 views

How can I remove unwanted CSS found in the parent theme? [duplicate]

I'm working on a sub-theme of Bootstrap Barrio, which includes a table.css stylesheet. I don't want this stylesheet from the parent theme to be included in my sub-theme. How do I eliminate a CSS ...
-1
votes
0answers
44 views

Acquia Cohesion demo version CSS formatting direct input?

Hello I requested a demo for Acquia Cohesion via this link: https://www.acquia.com/products-services/acquia-cohesion#create-sandbox I'm having a really hard time setting the CSS padding and margin ...
0
votes
1answer
44 views

Add CSS class to fieldset div element without extending the template

I only want to add a class to the inside the fieldset from fieldset.html.twig. It's a bit overkill to extend the template for just to add a class. How can I achieve this with a preprocess function? ...
0
votes
0answers
11 views

How to check if translation for the current node is available in node.html.twig? [duplicate]

I have two languages on my site. How can I check e.g. in node.html.twig whether a node has both translations?
-1
votes
0answers
14 views

Displaying content in the same div while using a for loop in twig template and avoiding rendering multiple divs with each iteration of the for loop

I have the following code in my twig file to render audio: {% for item in items %} {# some code ... #} {% if item.audio %} <div class="col-md-6"> <div class = "source-box audio"&...
0
votes
1answer
21 views

Fetching and rendering custom-library generated blocks in twig

I am using the following code in my theme to fetch 3 blocks (each containing 4 fields) generated via the custom block library interface i:e all 3 block are of the HomePage-Block type: function ...
0
votes
1answer
22 views

Output node reference field data in page.html.twig

I have a homepage node-type in which I have an entity-reference field holding 3 references to 3 separate custom blocks. The theme I'm working on requires that my 3 element reference field needs to be ...
0
votes
1answer
37 views

Can not override template for specific view

I'm new to Drupal so this might be a noobish question. I have a view called 'Category' where all posts are listed that belongs to the chosen category. I would like to override the views-view-...
0
votes
0answers
11 views

Exposed form block disappear when views has no results

I created a view template for my website in which i put my exposed form block with twig tweak module. It works when there is at least 1 result. But when my view has no result, the exposed form ...
0
votes
1answer
41 views

Naming convention for field type templates?

It seems that the naming convention for field types is undocumented. Looking at the classy theme shows a seemingly arbitrary convention. For example, the Text (formatted, long, with summary) type as ...
1
vote
1answer
21 views

separate the page title from page content

I am using {{ page.content }} to print all my page content. It is printing my all content but I want to remove title from this content and print it separately in different div structure (without using ...
0
votes
1answer
64 views

Specifying display of a new Paragraph type with images using HTML/twig?

I created "figure" Paragraphs type, which contains an image field and a caption field. How (from start to finish) do I specify in HTML/twig how to render this new Paragraphs type? As an example, how ...
0
votes
0answers
29 views

How do I apply HTML IDs to field output result?

I'm trying to build a block for tb_megamenu of a view of items of a certain content type. I want to use some JavaScript so that when the end user hovers over a title then associated content appears on ...
-2
votes
0answers
36 views

How to get BOOLEAN value of a Media Image in node.html.twig?

I was able to get the URL of the verctor_graphics reference media field with the following code: file_url(node.field_vector_graphics[0].entity.field_media_image.entity.fileuri) But how can I get the ...
-1
votes
0answers
19 views

How to add taxonomy term description to page--taxonomy--term.html.twig? [duplicate]

How can I add a taxonomy term description field value into page--taxonomy--term.html.twig?
0
votes
0answers
17 views

How to get drupal to check for a twig template in the active theme folder before checking the module folder?

I'm developing a contrib module for Drupal 8 that sends email notifications to group members when new content has been posted in groups they have subscribed to. The module defines some new view modes ...
3
votes
2answers
249 views

How should I include <link> or <style> inside <head>?

I'm trying to use a Google font, which requires adding either a <link> or <style> section inside the <head> per the below instructions. I am using a subtheme and can modify the ...
-4
votes
1answer
42 views

How do I add CSS classes to all the form elements?

How can I add the same CSS class (form__text) to form elements in Drupal 8?
0
votes
0answers
35 views

Add a region to the page--front.html.twig

I've created a few new region in my yml regions: header: "Header" jumbotron: "Jumbotron" chiffres: "Chiffres" steps: "Etapes" presentation: "Presentation des formules" ...
0
votes
1answer
30 views

How to check if custom variation field is null in twig?

I would like to know how to check if a custom variation field has content in a twig template (commerce-product.html.twig with variations injected). I have tried with some filters and conditions but ...
0
votes
0answers
11 views

Mode display specific Media Image formater template

i am having this template suggestion function amu_www_theme_suggestions_image_formatter_alter(array &$suggestions, array $variables) { $entity = $variables['item']->getEntity(); $...
2
votes
1answer
27 views

How to pass field value to referenced node template?

I have content type A. It has field reference to content type B. I'm rendering referenced node B from content type A twig template like: {{ content.field_referenced_object }} And that works well. ...
0
votes
0answers
38 views

How to display field_tags of a node in html.html.twig? [duplicate]

I want to display fields "field_summary" and "field_tags" of a node in html.html.twig (without using a module for that). I was already able to get "field_summary" value in html.html.twig with this ...
1
vote
1answer
25 views

twig template suggestion for comment reply form

there is no template suggestion for a comment reply form in Drupal 8, how can i create one? i am not talking about the reply form displayed in the node for which Drupal suggest a template : field--...
0
votes
4answers
78 views

How can I design the standard user login form with twig?

I want to change the labels "Username" and "Password" and delete "Create new account" link of the standard login form of Drupal 8. Is it possible to do this with twig?
0
votes
1answer
30 views

Why do I get an error after adding a .theme file?

After creating (e.g empty) .theme file in my template folder, I get the following error message: The website encountered an unexpected error. Please try again later.RuntimeException: Failed to ...
0
votes
1answer
57 views

Why does my do-nothing subtheme break the parent theme?

I'm trying to get started with sub theming in Drupal 8. I followed the example from the Drupal documentation and created what I thought was supposed to be an unmodified inherited copy of the Bartik ...

1
2 3 4 5
207