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

Image is “broken” with Custom Email Twig Template sending with Webform

The setup consists of Drupal 8 + Webform (ver. 5.6 - https://www.drupal.org/project/webform/releases/8.x-5.6) + CKEditor Image Upload (https://www.drupal.org/project/ckeditor_uploadimage). This allows ...
1
vote
1answer
40 views

Change Classes in Nav-Tag of Custom Menu

On a Drupal 8 installation, I have a menu in the sidebar first region. I want to add classes to bootstrap classes to the different levels of that menu. For that I created a my own menu template, which ...
1
vote
1answer
359 views

How do I theme the core modal with twig?

Drupal 8 comes with built in modals. This works: <a href="/node/11" class="use-ajax" data-dialog-type ="modal">modal</a> How can I style that modal using twig, to add new classes to the ...
0
votes
1answer
30 views

Why is library not being attached to my email twig template?

I am overriding the commerce-order-receipt.html.twig by adding that file to mytheme/templates/commerce. I then add these lines to mytheme.libraries.yml email: css: base: assets/css/email....
0
votes
1answer
45 views

How to get current language of node in twig?

I have a tranlatable node, and I need to get its translation language. You know, I must to know is current node is in Polish or English. So... below there are my devel dumps from a node in Polish and ...
1
vote
1answer
87 views

How to find the viewid and view-display-id?

I'm trying to customize a view displayed in the homepage. Specifically, I'm trying to build slideshow with Bootstrap Carousel. I've checked this page, but I don't understand how to find viewid or ...
0
votes
0answers
25 views

How to change per node the view mode of a media entity, which is referenced via a paragraph bundle? [duplicate]

A given content type contains a paragraphs field. This field references a paragraph bundle, which in turn references a media entity of type "image". The display of the media images is controlled with ...
0
votes
0answers
22 views

File field edit form change display style attachments

I need help. I would like change display attachments when edit entity. Default Drupal display attachments in table but I need change this to eg. unordered list or anything else - how to? I found many ...
0
votes
1answer
62 views

How do I display the date but not the author?

I want articles to show Submitted on without showing Submitted by. The checkbox on Display settings toggles both, not only one of them. Control/modify display settings (author and date) on posts ...
0
votes
0answers
30 views

Custom module with same twig template and two paths (e.g /pub and /pub/{id} )

I created a custom module to show nodes by taxonomy in a specific html twig. I created a controller that contain two functions. The first function called "content" pass an array to template twig ...
0
votes
0answers
18 views

Better exposed filters, hook form alter to specific template

On a view there are two exposed filters in one page. Rendered by BEF. For the template with BEF, I have a custom template. I need to alter this template. The #form_id and #id are exactly the same in ...
1
vote
1answer
124 views

How do I use PathMatcher::matchPath() for a wildcard path?

I am trying to use PathMatcher::matchPath() to match a string of paths using a wildcard pattern. I'd like to match any path containing /topic* so if the path matches, I'd like to add a body class ...
1
vote
1answer
64 views

How can I embed a view in a template when passing view name and parameters are passed as variables?

Inside my paragraph template I have variables which contain category id and view machine name. So when I print them like this: {{ content.field_category }} {{ content.field_view }} I get correct ...
0
votes
1answer
53 views

How to temporarily replace Drupal with static HTML pages?

I'm a JavaScript dev with no Drupal experience. I'm working with a church to redesign their Drupal site after their dev moved on without leaving any notes/documentation/etc. In the meantime, I'd like ...
-3
votes
2answers
83 views

Load a CSS file only for anonymous users visiting the front page

I want to load a CSS file only for the front page, and only for users who didn't log in. Both conditions should be met; in the other cases, the CSS file should not be added to the page. How do I ...
1
vote
1answer
252 views

Rendering a nested Paragraph's field using Twig

We are using the Drupal 8 Paragraphs module and are have a Paragraph which contains a Paragraph type field, called "Steps" (machine name fs_steps), allowing editors to add a number of "Step" ...
0
votes
0answers
41 views

Theming user-register-form.tpl.php with password set at registration

I'm using Drupal 7 and I've created a user-register-form.tpl.php to override the default user registration page at user/register. It displays all the fields I need except for the password fields. I'm ...
0
votes
1answer
57 views

Show Comment Form on its own Page or Popup

I am trying to figgure out how to show the comment form on its own page. So far I have been able to show it on a seperate page. All I had to do was to go to field comment setting and uncheck "Show ...
0
votes
1answer
53 views

I'm unable to access variables in template from preprocess function

I am using a preprocess function to get data from specific content types. I am able to print the data in the pre-process function but unable to view the same in the twig file. This is the code I am ...
0
votes
0answers
56 views

Why does “Barrio” subtheme already include some templates?

I'm creating a subtheme for Barrio, based on the subtheme included in the Barrio theme folder. It has already a template folder with some templates in it but, in my experience with other base themes, ...
1
vote
1answer
51 views

How can I pass multiple values to drupal_view()?

I'm on Drupal 8 and I have a view with multiple argument (list of node ID) but I can't embed this on my node.twig.html. That's my code: {% set myArray = [] %} {% for item in content....
1
vote
1answer
238 views

Exception\UnknownExtensionException: The module does not exist or is not installed

I get this error on my site Drupal\Core\Extension\Exception\UnknownExtensionException: The module does not exist or is not installed. in Drupal\Core\Extension\ExtensionList->getExtensionInfo() (...
0
votes
0answers
26 views

Adding button with Ajax callback in node using preprocess_node

I have my_theme and my_project. Also have a file called my_project.php. There I have two functions and in both of them I have ALMOST the same structure: function my_theme_preprocess_node__foo(&$...
-1
votes
2answers
259 views

Checking for the content type in html.html.twig

In the html.html.twig template, the task is to output different classes for the <body> tag, depending on the type of content. I know how to do this in the node template, but it doesn't work in ...
0
votes
1answer
28 views

How to change the view for a rendered product?

I'm learning Drupal Commerce with a Commerce Kickstart installation. I understood in part the way products are displayed, with variation types and content types. Have made some changes like visible/...
0
votes
0answers
29 views

Admin toolbar CSS broken by theme

I'm facing issue with Admin toolbar. Every time I create theme and define default style guide for typography eg.: ... h2 { font-size: 3rem; } p { font-size: 1.2rem; } ... Admin toolbar's CSS is ...
0
votes
0answers
39 views

Hide view's elements onfirst load, show them on filter click and reset it again by general data filter

Edit As my first question I made some mistakes, so I'm trying to keep it more clear and useful for other people. The scenario: I built a View showing nodes and contextual filters to have taxonomy ...
-2
votes
1answer
65 views

Updating 7 to 8, how to remove .less / scss files

I am updating a website from Drupal 7 to Drupal 8 and suddenly I see all these .less files influencing the style of the page. I found them in the theme's /srss directory (mytheme/srss/bootstrap/) ...
0
votes
1answer
33 views

Unable to retrieve checkbox values from a template file

I have created a checkbox option for a field. Category One Two Three Four This is the code I am using. {% for key, item in content.field_room_category if key|first != '#' %} <li>...
0
votes
1answer
31 views

Variable in file-audio.html.twig

I created the following preprocess function to add a value. function mytheme_preprocess_node__audio(&$variables) { $node = $variables['node']; $media_field = $node->get('field_image')->...
0
votes
1answer
27 views

How do I prevent the HTML markup in an item list from being escaped?

As you can see in the code below, I try various ways to prevent Drupal from escaping the HTML and passing the link tags to the output, including the use of '#allowed_tags' and the Markup class. None ...
0
votes
0answers
60 views

Is a block render array built with EntityViewBuilderInterface::view supposed to render full block template or only inner fields?

After rendering custom blocks in templates, I got this js error: Quick Edit could not associate the rendered entity field markup. What I've done so far : In order to render repeatedly custom blocks ...
2
votes
1answer
116 views

How to embed HTML and CSS in a custom form element?

This worked in Drupal 7 but isn't in Drupal 8. $form['covid-19'] = array( '#markup' => '<div style="border: 2px solid red;padding:10px;margin-bottom:10px;"><strong>Due to the COVID-...
0
votes
1answer
38 views

Sub-theme adding prefix to all block machine names

On my site, I have created a sub-theme of a sub-theme using this as a guide to set this up https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme and it ...
0
votes
1answer
21 views

Upgrading to Drupal 8, custom theme not using referenced CSS file [closed]

I am upgrading a theme from Drupal 7 to Drupal 8. I reference .css files in mytheme.library.yml that do not seem to be getting pulled into the site. I've looked online and even copied sample coding ...
0
votes
0answers
43 views

Print a taxonomy term and url D8 views template

I am totally new to drupal 8. I have used d7 and i am migrating now. I have setup a view with 4 articles. I have managed to print out in a custom views theme my title image url {% for row in ...
0
votes
0answers
27 views

getUrlObject() returning empty proto object

I'm trying to follow this post to turn my menu tree into an array I can more easily work with. When I run my code and look at $filteredArray I get: title: *Name here* url_obj: {} has_children: true ...
0
votes
1answer
16 views

How can I render an image stocked in a custom module with an image style?

I'am learning Drupal 8, and I would like create a custom module who create a block to add share button. The link of this button should be an image who stocked in my custom module. I would like use an ...
4
votes
1answer
129 views

What is the difference between renderPlain and renderRoot?

I added a login form to a node with following code : function my_theme_preprocess_node(&$variables) { $node = $variables['node']; $variables['login_form'] = FALSE; $variables['username'] = ...
0
votes
1answer
27 views

Using variation values in a template file

I am building a site that uses Drupal Commerce 2 and I am attempting to build out the product details template. Our product has a variation (field_accessories) which is an entity reference to another ...
0
votes
1answer
48 views

How do I conditionally add a class to my page title within page-title.html.twig?

I have a boolean field within my Page content type called Hide Title. I need to conditionally add a class to h1's to visually hide them if this field is checked. I have the following within page-...
0
votes
0answers
36 views

Setting Views contextual filter values dynamically with Twig in Webform

I am attempting to embed a view in a webform whose contextual filter value is set based on a user selection. I have created a view of nodes with a contextual filter, and a webform with a select ...
0
votes
0answers
44 views

Access a page.html.twig template variable in another twig template using a preprocess function

Drupal core 8.8.3 Version Using a preprocessor function as below function subtheme_bs_preprocess_book_tree(&$variables) { $variables['page_id'] = code here to read the node.nid variable ...
0
votes
2answers
72 views

Geting values for multipart form elements using Twig

Whereever you are, I hope you're fairing well under the circumstances. To some of the hardest hit areas, we are thinking of you constantly. Webform Advanced Elements I am having difficulty ...
0
votes
0answers
10 views

How to change librarie's css from xxx.theme or hooks

I want to alter the path of the css of the mmenu library (jquery.mmenu.css and jquery.mmnenu.all.css) which are in (/libraries/mmenu/dist/jquery.mmenu.css and / libraries / mmenu / dist /jquery.mmenu....
0
votes
0answers
25 views

Strange behaviour in twig template

I am trying to render image in custom field.html.twig template but following snippet not working: {% for item in items %} {% if not loop.first %} <div class="image-gallery-image"&...
0
votes
1answer
63 views

how to create custom template for a product type in drupal 8 commerce

I want to have separate twig templates for each product type in drupal 8 commerce to customize them. is there any way to do that?
0
votes
0answers
79 views

Date range issues with timezones in twig

We're using date ranges for some events in an application. We're finding that when we use the date value and end_value independent of one another then the timezone is incorrect. For example, inside a ...
0
votes
0answers
19 views

Hiding the next page button in Webform after required question is completed

I am designing a webform (Drupal 8 webform 8.x-5.8) to serve questionnaires to patients and to ease the patients load of filling in questionnaires I would like to automatically advance the webform to ...
0
votes
1answer
64 views

Use page.html.twig template variable in another twig template

How do I call a page.html.twig template variable from the book-tree.html.twig template. Using kint, I have found the variable, nid as in the screenshot below: The 'nid' is highlighted, but it is the ...

1
3 4
5
6 7
208