Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [theming]

Use it for questions about rendering or modifying the HTML markup produced by a module/theme.

1
vote
0answers
17 views

Can't figure out how to pull out twig variables

Trying to use some twig variables (simple strings) in a template that i created from a custom module. Using devel and KINT I can see the info under Iterator contents with {{kint(transaction[0])}} I ...
0
votes
1answer
14 views

Trying to display or render values from links field within paragraph field base on its current language

I'm currently using Drupal 8 Paragraph and I'm trying to figure out how I can display or output the url and title of a link field from within a Paragraph base on the current language via preprocess. ...
0
votes
1answer
17 views

How to display custom fields of taxonomy in field twig

In my content type for Event, I have an entity reference called Speakers which refers to a taxonomy called Team Members. It's set to multiple so I can say which speakers belong to my event. On ...
1
vote
0answers
36 views

Custom template not used for custom entity generated with Drupal Console [on hold]

I have created a custom entity via drupal console, and it created template item_entity.html.twig in template folder, but the entity is being rendered in some other way because any changes in template ...
0
votes
0answers
30 views

Form action as controller method?

I'm trying to fix a form that was created using a twig template. The form was not working because there was no action, nor was the form created using FormStateInterface. It's just a block that is ...
0
votes
1answer
31 views

How to check if view result is empty Twig

To check the field I use the following code: {% if content.field_name|render is empty %} How to check on node.twig if {{ my_cool_view }} result is empty? Is this generally possible in Drupal 8? ...
-1
votes
0answers
18 views

How can I change the css attributes of the sub-item of theme template in my custom module?

I use the system built-in block of "User account menu" in my page. The twig file is core/themes/classy/templates/navigation/menu.html, and this is the html output: <ul class="menu"> <li ...
-3
votes
0answers
31 views

Defective occurrences [on hold]

After running manual test on the webform's established throughout various pages, (e.g. home page, contact page), I have acquired the following occurrences: When entering data into the message text ...
-5
votes
0answers
21 views

How to use image in CSS-file of custom theme [on hold]

I have a custom theme. The folder structure is like this: web |-- themes |-- custom |-- mytheme |-- css |-- js ...
-2
votes
0answers
16 views

Update resulted in Page Error's [on hold]

After updating the 'Webform' module, the site now provides the following error message for various pages: "The website encountered an unexpected error. Please try again later.The website encountered ...
0
votes
1answer
17 views

How to append options and classes into a custom attribute in Twig?

In our twig template we have a need to wrap certain fields with a Link field. In the existing twig template there already exist an attributes variable (accessed by adding attributes), but we have a ...
0
votes
1answer
29 views

Altering Views Exposed Form Elements and their Associated Labels

I have a series of Views Exposed Forms across a Drupal 8 website. My goal is to generate unique template suggestions so I can theme each individual input and their labels differently as needed. Here ...
0
votes
1answer
12 views

Theme preprocess for module's template variables using dynamic path

I am doing templating for a module that adds a block in the module's folder so that the template can be there, and it may be overridden in the theme if desired. I want the module to support different "...
0
votes
2answers
27 views

How to insert fields into a link field in twig?

We have several fields on our Article content type, one of which is a Link field. In a twig template we would like to display a <section> such that all of it is clickable with different fields ...
0
votes
1answer
26 views

How to automatically post a message with the discount on the site?

I have a store with Commerce 2 and Drupal 8. In my store I created a reminder of 20% on the whole site. I want a message to be posted on my site with the conditions, the percentage, the end date and ...
0
votes
1answer
13 views

How to create a theme function for overriding Address Field theming?

How do you create a theme function for overriding the formatting of an Address Field in Drupal 7? I didn't want to create a CTools plugin or work with render arrays.
0
votes
1answer
18 views

Using content type fields within page.html.twig

I am new to Drupal 8, and relatively new to Drupal templating in general. Here's what I am trying to do: I have a content type, called "Property" with a "header_color" field. When I add a property, ...
1
vote
1answer
45 views

How many libraries is too much before there is a performance issue? [closed]

We are using Paragraphs module to allow for selecting of up to 15 different Paragraph Types. As part of this, each one requires its own CSS and JS since they are vastly different. We already have a ...
-1
votes
0answers
15 views

How to clear error Only variables should be passed by reference [duplicate]

As part of adding a new region above comments on my site, i followed the instructions HERE and added the following code to my THEME_preprocess_node $variables ['new_region'] = drupal_render(...
0
votes
1answer
23 views

How do I add an “if” to style a specifc field name

In my Drupal 8 site, I would like to add a css style specifically to one Field. In Content Type - Basic Page I have added a 2nd Text area,(additional to the main one). I know what it's machine name is,...
0
votes
0answers
12 views

Error on drush command: In ThemeHandler.php The theme does not exist

I manage to broke the default theme in development and now could not access the administration interface nor could I change the theme via drush. The way I broke the default theme is by changing the ...
1
vote
1answer
23 views

Viewing an image file breaks if view mode has responsive image style

I have an image file that I am viewing programmatically. When I set the image format to "responsive image" in file display settings, it breaks with an error Error: Call to a member function ...
0
votes
1answer
40 views

how to override module's theme function in a custom module?

I'm a Drupal8 newbie. I installed a third party module simplelogin, and I attempted to change the {{site_name}} value in page--simplelogin.html.twig but can not find a right way. I noticed that the ...
1
vote
1answer
34 views

Class from module not found in theme [closed]

I've got a class defined with: namespace Drupal\mymodule\Component class MyCustomClass { public static $aVar; public static function do_a_thing(){ return self::$aVar; } } And in mytheme....
0
votes
0answers
21 views

Page class in body gone

I am currently working on an old Drupal website. I had to upgrade the version from 7.19 to 7.61. After this update, everything is still working except for one thing. Before the update when you went to ...
0
votes
0answers
24 views

Display tooltip help text on the node display page

I search all over the internet with no success answer for my requirement... I want to display help text for each field on the node display page (ex: /node/16) and not on the node edit page (ex: /node/...
2
votes
1answer
25 views

Using different field template suggestion in different view mode

I have a field field_a that has a template suggestion of field--node--field_a.html.twig. Using that field template suggestion, I've modified the field to render a certain way within the template field-...
0
votes
0answers
36 views

Email Formatting

I'm trying to theme our emails sent by webforms. I can't figure out how to remove the default theming for our site's logo from the email body. I've copied the webform-email-message-html.html.twig file ...
-2
votes
1answer
49 views

How can I put custom javascript file at bottom [closed]

When I want to override sites/all/libraries Example/example.js file from my custom js file but example.js file at bottom than custom.js file the problem is not give my result of custom.js file ...
0
votes
1answer
24 views

How display node author roles at node.html.twig

My user case is: Extlink module can add exception classes to avoid processing some links. I want some external url links on nodes whom author belongs to a special role (premium) can be mark with a ...
0
votes
1answer
44 views

How to get rendered content properties from an entity reference in Twig

I'm using the Stock Photo Search module, for particular image fields, and it has its own field type with interesting properties. As far as I can tell, the only way to access the URI of the image is ...
0
votes
0answers
26 views

How can paragraph type's fields display in two different node fields?

There is a paragraph type 'paragraph01', it contains two fields: field_paragraph01_01 and field_paragraph01_02. And a content type contains two node fields: field_01 (referenced paragraph01),field_02 ...
0
votes
0answers
27 views

How to change the icon classes using mmenu

I'm new to the drupal community, so I'm sorry if I make any mistakes in posting this question. I want to change the menu-item icons for the Mobile sliding menu module. I realize that my question is ...
-2
votes
1answer
24 views

How to edit the spacing of content like padding/margin/line-height in any existing theme of drupal [closed]

I am working with Drupal W3CSS theme. I am a newbie to Drupal and Programming both. I want to edit the spacing of content such as it's padding/marging inside the content wrapper. Like this. left ...
0
votes
1answer
20 views

is there any way to remove “Password reset instructions” hint on reset you password page?

Could not find any hooks or templates for it.
0
votes
1answer
28 views

New sub-theme not showing in appearance

I am working with Drupal's Open social framework where in I copy socialblue theme so that i can do my modifications in the new theme. I followed the below steps, cleared cache, yet I am not able to ...
0
votes
1answer
39 views

Convert node URL to absolute

We are using Drupal Core v8.6.2 and we have a url variable in our node--page.html.twig template. While using ksm() and {{ kint() }} we are finding that if we use hook_preproces_node($variables) that ...
1
vote
0answers
27 views

Adding Price Attributes

I am searching how to add price values to existing product attributes in Drupal Commerce 2.X For Example: T-shirt price = $10.00 A product variation/color = Red = +$2.00 A product variation/size = ...
3
votes
2answers
115 views

How to make author name hyperlinked to its profile in node template

There is a variable {{ author_name }} in node.html.twig, it will print something like below: <span>Your author name</span> But I would like to print something like that: <a href='/...
1
vote
2answers
61 views

What is the right way to use a different base theme for some pages when applying custom theme?

I know that custom theme usually inherited from the "stable" theme, and the default backend theme is "seven. I like the UI of "/user/login","/user/register" and "/forum" pages. If I use a custom theme ...
0
votes
2answers
46 views

Display custom variables

We have a twig template, node--page.html.twig where we want to display the custom variable ns-custom-template. The variable is created from a custom module, mymodule with the following code below. ...
2
votes
1answer
25 views

how to just print the value of author in node template

There are some variables like author_name in node.html.twig of Drupal 8. {{ author_name }} will print something like below: <div><span><span>Basic</span></span></div&...
0
votes
1answer
31 views

Output the term title on page--custom.html.twig

I'm pulling my hair out trying to create a custom page--custom.html.twig for a content type and getting taxonomy terms to display. I'm currently using the following piece of code: {% if node....
0
votes
1answer
37 views

Getting form variables data into twig templates

I need to pass an array to twig along with the form. public function buildForm(array $form, FormStateInterface $form_state) { $form['job_locations'] = $job_locations; $form['#theme'] = '...
1
vote
2answers
64 views

How do I link a page in a template? [closed]

If there is a basic page with the route '/about', how can I link it in a template file? <a href="{{ What goes here? }}"></a>
1
vote
1answer
41 views

Get Link value in Media entity

We have a Media type called Documents that has a Link field called field_link. We need to obtain the URL (external or internal) from the field so that we can use to wrap block elements inside of a <...
0
votes
1answer
41 views

Get pre-processed data from nested Paragraphs

I am new to Drupal and building a theme with Drupal 8 + PatternLab. Instead of printing the actual paragraphs, I just extract the data from the fields and pass it to the front-end twig modules. For ...
2
votes
1answer
94 views

How can check if a field is empty in a node template?

I am using Drupal 8. I have a paragraphs field (field type: paragraphs of reference revisions) in node template, I tried lots of ways to check if the field is empty (purpose is to show the field only ...
2
votes
2answers
67 views

How can check if current user is node author in node template

I am using Drupal 8. I would like to check if user (anonymous or logged user) is node author in node.html.twig, like below: {# node.html.twig #} {% if is_author %} You are node author {% else ...
0
votes
1answer
36 views

Translation of a element['#object'] rendered field

I have some fields in which I rendered additional fields from a nested term via element['#object']: e.g. {{ element['#object'].field_country.entity.name.value }} Unfortunately, this fields do not ...