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
11 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
13 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
0answers
5 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
38 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
20 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
23 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
votes
0answers
15 views

How to geocode an address using google map API

Drupal 8 Modules: composer require drupal/geofield_map composer require drupal/geocoder:^3.0@beta composer require geocoder-php/google-maps-provider composer require drupal/address Add a node: ...
0
votes
0answers
32 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
23 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(&$...
-2
votes
0answers
28 views

How to display a result counter in the page menu link?

I have a navigation menu on my site, each menu link corresponds to a page of views. I want to display in front of each menu link, a badge with the number of results of the corresponding page views. ...
-1
votes
2answers
38 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
23 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
21 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
18 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
0answers
30 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
31 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
20 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
23 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
22 views

How to optimize the Glyphicons font with font-display: swap? [closed]

I want to optimize the loading of the Glyphicons font for the Google PageSpeed Insights tool. I need to apply the CSS code below : font-display: swap Here is the location of my font : https://...
0
votes
0answers
34 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 ...
0
votes
1answer
31 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
30 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
19 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
34 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
25 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
13 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 ...
2
votes
1answer
44 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
20 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
27 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
26 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
38 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
37 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
9 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
23 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
8 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
44 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
13 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
61 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 ...
0
votes
1answer
27 views

Extract email addresses from composite field type using Computed Twig

I am using a custom composite field type to gather multiple pieces of data from a user. This custom composite field type contains a field which gathers the email addresses entered. What I am trying ...
2
votes
1answer
50 views

Why is libraries-override not removing assets?

My attempt to remove CSS and JS assets is not working. I have placed the following declarations in my module's *.info.yml file. But after clearing the cache, I still see the assets in the head of ...
0
votes
1answer
23 views

Basic page template

I am using Drupal 7 to create a page and a custom template for that page. I created a page from Content >> Add Content >> Page. In my theme /template folder I have created a file called page--my-...
0
votes
0answers
25 views

Spacing with inline links in TranslatableMarkup

I have a TranslatableMarkup string that has a link that is inserted in it as a variable. However this link comes without a space between the link and the previous word in the string. $message = new ...
0
votes
1answer
25 views

Load id of paragraph in hook_preprocess_layout using load($id) method

I want to load the paragraph id in theme preprocess. function theme_preprocess_layout(&$variables) { $ID = $variables['content']['#paragraph'] ???; "contents - protected 'id' => array(1) = ...
0
votes
3answers
45 views

Override templates for one view page or block

I am trying to figure out if there is a way to override the base templates for one view. I created a page with a view called 'Promotions'. I need to override the views-view-field.html.twig, views-view-...
0
votes
0answers
29 views

Issue with Access PHP array in display module

I am trying to use result['data'] to new custom module. fgsis theme and all are custom template and modules. I have module fgs_api.module where I have function which returns results->data and get ...
-3
votes
0answers
17 views

How to create filters for product fields in Ubercart?

I have installed ubercart module in drupal 8. I want to display filters on ubercart catalog page. Please help me How to add filters on ubercart catalog page.
0
votes
0answers
19 views

How do I create a template to display view fields [duplicate]

I created a view and added it as a block. Now what I want to do is to manage the way the fields are displayed. However, when I inspect the page, twig doesn't show me a template name that I can use to ...
-1
votes
0answers
47 views

Ajax submit form data to controller and update content in twig template

EDIT: My first code example had some faults.. I believe that I now have a module of a working non Ajax Form. - Any help pointing me in the right direction to submit and update the output with ajax is ...
0
votes
2answers
41 views

Can I somehow edit libraries.yml files from the backend using the admin panel?

In my Drupal project, we load custom CSS for some of our specific pages. Right now I do all of these modifications programmatically. But what our manager wants is to create it manually in the admin ...
0
votes
1answer
33 views

How to display an alternative text if the comments are closed for the node?

in my node type template, how do I display alternate text if comments are closed for the node ? {% if content.comment %} <div class="card mb-5 p-3 shadow"> {{ content.comment }} ...

1
2 3 4 5
206