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

What did I write incorrectly in the node.js service configurations required for the Bootstrap 4 - Barrio SASS subtheme? [closed]

I raise a Drupal site on docker, namely - docker4drupal (a set of already created images: php, nginx, mariadb, etc.) https://github.com/wodby/docker4drupal I need to create a subtheme based on ...
0
votes
0answers
8 views

Override the field template in the view

I have a view that outputs the fields needed and I would like to change the template of one field in this view. I need exactly override the views-field-field-product-color-field-color-color field ...
-1
votes
1answer
18 views

anchor menu description under each menu in menu.html.twig

I am currently displaying the Menu "description" underneath each link using menu.html.twig. by doing this: {% if item.original_link.getDescription %} <span class="navigation__link-...
-1
votes
1answer
20 views

How do I call a twig template from a module?

I have created a module, and some templates which override a view. I am trying to include these templates in my modules. I have mymodule/templates with several templates, overriding a mixture of the ...
1
vote
0answers
13 views

Filter view based on current user's role and taxonomy terms in drupal 8

I have three content types Article Basic Page Custom Page All Content types consists a field "field_interests" that is referenced to a taxonomy_term "interests". Items of ...
0
votes
0answers
15 views

Breakpoints in custom theme not showing in the "group breakpoints" field

I'm having a problem that i simply can't find how to resolve it. I've created a custom theme based on the "claro" from drupal core. Then I've installed the modules Breakpoints + Responsive ...
0
votes
0answers
26 views

How to make Twig variable provided by module available to a twig template of an other module?

I am a newbie when it comes to combining drupal's API functions with a twig template. I've created a node filed called font awesome icon The Twig variables of this field are in fontawesomeicon.html....
1
vote
1answer
21 views

How to add inline CSS style in Custom Text of Views?

I have already setup fields for user to input color code (e.g. "#123000") to a content type. Now I need to modify the inline style color / background-color with the given value. I tried to ...
1
vote
1answer
20 views

Conditionally display headers on web page in page.html.twig

We have a header which contains a secondary menu on top bar, search, main menu and logo in page.html.twig. We would like to implement a new header with quite a few changes and so would like to add a ...
0
votes
1answer
17 views

Why does ThemeInitialization.php have fatal error: allowed memory exhausted? [closed]

In the process of upgrading a Drupal site from Drupal 8 to Drupal 9 I caused a problem where infinite memory is consumed by ThemeInitialization.php, no matter how much is allocated by php.ini. After ...
0
votes
0answers
19 views

Menu item extras field in page.html.twig

I need a background image per menu item. For this I'm using menu_item_extras. I added an image field to menu items. This field I'd like to use in page.html.twig. How can I use this field in this ...
0
votes
1answer
31 views

How do I get the entity ID from a view row and pass it along to the item list template?

I have a view which returns rows of entities. Each entity has several multi-value fields. The structure is kinda like this: Field 1: Item A Item B Item C ... Item H Field 2: Item A Item B Item C ...
0
votes
1answer
20 views

How get the info of a element in webform email twig?

I'm on D9, theming a webform email. I'm currently overriding the twig file, instead of using the configuration of the body in the email hanlder, because there are various conditional logic I've to ...
-1
votes
0answers
40 views

Custom default theme's Global Styling not being applied

I have a very simple site-specific custom theme that is based on a company theme that is based on bootstrap barrio. In the site-specific theme, I simply have the following files: site_theme.info.yml ...
-1
votes
1answer
61 views

How to remove big pipe <script> tags from page response

I need to remove <script> tags from some pages. I have managed to remove almost all of them, but these remain: <script type="application/vnd.drupal-ajax" data-big-pipe-event="...
0
votes
0answers
40 views

Render fields and results of a custom form in two separated regions

I have a custom form (created programmatically). I want to keep the AJAX submission mode. I would like to render the fields of the form in a region SIDEBAR and then the results in the region CONTENT. ...
-2
votes
0answers
24 views

How can use hook_preprocess_block(&$variables) to use a template file from a custom module? [duplicate]

I have a custom block type, which has a taxonomy term reference field to a taxonomy term. I created a block of this type and assigned it to the page footer. I want to replace the content of the block ...
0
votes
1answer
35 views

Is there a way to render the title of every node from a single content type?

I have a page on a Drupal 9 site that will have a filter and a search bar. The filter needs to have each product and each region the product is sold in. So I created 2 content types - Product and ...
-1
votes
1answer
42 views

How do I suggest to use a template name like "node--[content-type-name]"?

I would like to name my node template after the content type title, but my suggestions only show the node number. FILE NAME SUGGESTIONS: html--node--1.html.twig html--node--%.html.twig html--node....
0
votes
1answer
16 views

Access product field from variation field

There are a bunch of product images that are named same as SKU, so I'm just using field--commerce-product-variation--sku.html.twig to show them. All is fine. I'd like to use the parent product image ...
0
votes
0answers
14 views

Changing base theme directory

I have inherited an 8.x site using ZURB Foundation as a base theme. However: Foundation somehow got installed twice, once in docroot/themes/zurb_foundation (8.x-6.0-alpha4) and once in docroot/themes/...
0
votes
1answer
30 views

Hash in menu item url are removed when displaying the menu on a page

If a menu item has a submenu and I specify the hash symbol (#) in the Link field of such parent menu item in the admin panel, I receive empty url at the frontend and therefore if click by such link, I ...
-2
votes
1answer
37 views

"The website encountered an unexpected error" when creating contrib and custom folders

My Bootstrap Theme in Drupal is currently in the location var/www/html/project/themes/bootstrap on my laptop. However, when I create a new directory- contrib (inside the themes directory) and move the ...
1
vote
1answer
18 views

Customized email twig templates

Can anyone tell me if there is a mechanism for creating user registration acceptance / rejection emails from different template files for the default email system ? In admin/config/people/accounts, ...
0
votes
0answers
31 views

How do I pass a node field variable into a layout builder section template?

So far what I understand is I need to start with this: function mytheme_preprocess_layout__twocol_section in my .theme file, but I'm not quite sure where to go from there. For clarification, I have a ...
0
votes
1answer
44 views

Access (none related) entities from within twig without preprocessing

Within a nodes Twig template I am able to access e.g. referenced fields with... {{ node.field_my_entity_reference.0.entity.field_my_field.0.value }} With the help of Twig Tweak I am able to render ...
0
votes
1answer
40 views

How to add a user role as a body class to the admin theme, Seven? [duplicate]

I need to add a user role class to the body tag in the Seven theme, our admin theme. What is the best way to manage that without touching Seven? Is it even possible? Ultimately, I'm trying to hide a ...
0
votes
1answer
56 views

How to access url of Remote Video, Document and Image inside twig template?

I have a field called Media (machine name: field_media) inside of a content type. This field Media takes the media types of Remote video, Image, and Documents. I am currently trying to render this ...
0
votes
0answers
19 views

How can I use the time.html.twig template for the node "created" field?

When a view shows a date from a newly created field, it uses the time.html.twig template. When it shows the node created field, it just prints a string surrounded by <span> tags. I'm guessing I ...
1
vote
2answers
124 views

Accessing node value in paragraph twig template

I'm writing a twig template for a paragraph. I'd like to access a text field value from the page/node where this type of paragraph will be added. Specifically, I'd like to access the value of a text ...
0
votes
1answer
26 views

How can I print recipient mail address in webform email handler body with twig?

In the webform e-mail handler configuration I can see that webform twig variable is available. I looked to the context with xDebug and it looks like I should be able to print e-mail address of the ...
0
votes
1answer
57 views

Within a node template how can I tell what regions are in use/ occupied?

I am trying to create a preprocess function in my .theme file in order to make a variable available to node templates. I want the variable to contain just the names of all regions that are currently ...
-2
votes
2answers
49 views

Libraries, CSS, and conditional loading

In looking at the attached screen shot from mytheme.libraries.yml, I see 'base:', 'component', 'layout', 'theme', and so on. Do these designations represent/do anything in practice? Or is this just ...
3
votes
1answer
97 views

Prevent rendering of Layout Builder regions that have no content

Using Layout Builder, when you add a block to a layout that has access controls and a user visits a page without access, the layout is empty. How does one prevent the layout from rendering at all if ...
-1
votes
1answer
80 views

How to handle different output for a same block (Caching Problem)? [duplicate]

I have a theme which has two different appearance for main menu block, so I wrote a theme suggestion like this: function MYTHEME_theme_suggestions_menu_alter(array &$suggestions, array $variables) ...
1
vote
1answer
16 views

Why is <my_entity>-content-add-list.html.twig template not being used?

I have generated a custom content entity via the Drupal Console. It has bundles. I would like to customise the screen which you get to when adding a new such entity - the screen which displays the ...
1
vote
1answer
27 views

How can I assign custom field layouts using paragraphs?

For reference: -modules --contrib ---ds --custom ---ds I'm looking to add paragraph layouts using flexbox. I don't see a module specifically for this, so I realize I'm going to have to adapt an ...
1
vote
1answer
44 views

Site branding not displaying correctly

I'm working on a new theme for the Rain distribution (Drupal 9), but I'm having a hard time showing site branding correctly. This is the first time I'm trying to make a theme, so sorry if I ask stupid....
0
votes
0answers
12 views

theme_preprocess_form_element can't remove $field_suffix

I'm trying to remove #field_prefix by using theme_preprocess_form_element like this function estore_preprocess_form_element(&$variables) { if (isset($variables['name']) && $variables['...
0
votes
0answers
60 views

How do I properly render links in custom item list when using complex render array?

I wish to use a custom item list template in a module that changes the <h3> tag. The items I am rendering are link render arrays. When I use the default template, a link render array works ...
0
votes
1answer
19 views

Add class to field parent with a preprocess hook in a custom module?

Background: I would like to alter the classes that are added to a rendered field in Drupal 9 in a custom module. I'm trying to use hook_preprocess_field and I'm not sure if this will work or if there ...
1
vote
0answers
27 views

How do I add a template suggestion for form input fields that have containers?

I've been able to successfully add the parent form ID to all form elements, based on these two questions: How can we find the id of the parent form in preprocess_HOOK() or HOOK_alter() theme functions?...
3
votes
1answer
118 views

How can I build a render array that results in a string rather than a Drupal\Core\Render\Markup object?

I'd like to use Twig Tweak's drupal_view() to render a view in my paragraph template. I have a couple entity reference fields on the paragraph and need the IDs of the referenced entities passed as ...
0
votes
0answers
31 views

Load css and js assets as absolute paths during twig render

By default, Drupal 8 loads css and js libraries using relative paths. ie: /core/modules/contextual/css/contextual.module.css However, because I want to generate static pages to be used by another ...
0
votes
1answer
48 views

Custom html.html.twig for a display mode

While using display suite in drupal 8.6.2 Is it possible to have a custom displaymode-html.html.twig that replaces the default html.html.twig? So far I have tried enabling the view mode dev hints in ...
0
votes
1answer
62 views

How to alter page title "Create X" to "Add X" for all X?

In Drupal 7, there was drupal_get_title()and drupal_set_title(). They're history. I want to alter the page title "Create X" to "Add X" for all X, and I think ...
2
votes
0answers
38 views

How to get content url in views-view-unformatted block template

In Drupal 8, I created template for solr search view views-view-unformatted--solr_search_content--block.html.twig I am trying to print the content link by {{ row.content['#view'].style_plugin....
0
votes
1answer
30 views

A specified library is missing

On a custom theme "foobar" (based on Olivero) this error message occured. This custom theme is a copy of drupals 9.2.2 olivero's theme. Drupal\Core\Asset\Exception\...
2
votes
1answer
50 views

correct way to access node-revision change property in twig

I have a Drupal 8.9.17 website. My theme (based on Garland) includes in templates/page.html.twig: {% if node %} [...] Last updated {{ node.changed.value|format_date('custom', 'D M d Y') }} [...] {% ...
0
votes
2answers
50 views

"block_name" not found

I installed the Twig Tweak module. {{ drupal_block('block_name') }} doesn't work. In Drupal logs I get the error The "block_name" was not found "block_name" I get from the ...

1
2 3 4 5
213