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

How we can remove field--type-entity-reference-revisions div from a paragraph

I am using paragraph module. and create a twig tempate for the paragraph - paragraph--machine-name--default.html.twig but It generated a div at starting of paragraph having class field field--name-...
0
votes
1answer
43 views

How can I print the translated entity title in a template?

I have a reference field for nodes and I have a field template to render the the fields. {{ item.entity.title.value }} But I can't get the translated title of the node. Can someone help?
-1
votes
0answers
10 views

Simplenews E-Mail Teamplate

I would like to send our newsletter to our subscribers via our website using the Simplenews module. I have created a content type for the newsletter topics and one for the newsletter. In the ...
1
vote
0answers
21 views

How to set the href with the pathname of the current page in it?

Inside a view I have a block for which there is a field called Global Perspective. Inside the block override , I have rewrite rules which overrides teh out of the field with custom text. <div class=...
0
votes
0answers
31 views

Administrator tab and contextual links not working in view

For some reason whenever I create a view, there seems to be some CSS problem with the administration bar, aswell as the button to edit which doesnt appear for any block. In comparison with a regular ...
0
votes
1answer
16 views

Get taxonomy field value in forum-list.html.twig

I am customizing the appearance of the forums. I added all my forums and container. Additionally, I added a custom taxonomy field I need to show for each forum category. How can I show the custom ...
-1
votes
1answer
41 views

How to debug and find variables on twig themes

I'm trying to create a theme for a drupal web site, but I find it difficult to get variables. Here is an example: to get an image form a view I wrote this line row.content['#row']._entity.field_image....
-2
votes
0answers
41 views

How to get drupal fields and customize themes

I'm trying to customize a Drupal 8 theme, but I'm getting tired to guess the path of getting different fields of data types. for example, here are some few examples: row.content['#row']._entity.title....
0
votes
1answer
37 views

When doing a page preprocess, how do you know if the page is a form?

When doing a preprocess on a page (I need to conditionally change something at the page template level) is there a way to tell if the page is going to render a form? The xdebug output didn't show any ...
0
votes
0answers
17 views

How to declare several templates for a Views row plugin

I want to create a custom Views display type called Card using Fields for the rows. In my module I define the relevant plugins using hook_views_plugins as such: function cards_format_views_plugins() ...
0
votes
0answers
20 views

How to use Blazy in a custom Twig with Responsive Images and WebP

I have a node twig template and I'm rendering Responsive images like so: {% set pmpFact1Path = node.field_pmp_fact1_image.entity.uri.value %} {% set pmpFact1ResponsiveImageStyle = { '#...
0
votes
1answer
27 views

views.view.unformated.html.twig taxonomy conditional if/else

I am trying to get to the field_news_type term_id/label. I can print the field and I get the term label. Need guideance to be able to select which one I want to use. {{ fields.field_news_type.content }...
0
votes
0answers
24 views

How do I get the path or url to commerce product for views-view-fields.html.twig

I use the commerce module and VIEWS to build a product list. For this product list I like to have an output like this: <ul> <li> <...
0
votes
0answers
19 views

How to display the machine name of the product type?

In the Twig file of my product, I get the type of product to which it belongs thanks to this code : {{ message.field_product_reference.entity.type.entity.label }} This code displays the title of the ...
0
votes
0answers
20 views

Problem in understanding how to manage templates

I'm new to Drupal (and more precisely to version 9), I've been reading resources and tutorials about custom theme creation for 3 days. I can't figure out how to organize my templates and especially ...
-1
votes
1answer
30 views

How to get field value from paragraph entity in twig?

Is it possible to get the value from the field inside the paragraph in the red rectangle. This code part is placed within a twig-template "field--block-content--field-example.html.twig" {% ...
3
votes
1answer
38 views

How to determine if {{user_picture}} is not empty in the comment.html.twig template

Trying to determine if {{user_picture}} is not empty in the comment.html.twig template. {{user_picture}} refers to the Compact display mode for a User Entity. The below code doesn't work. {% if ...
-1
votes
0answers
37 views

Node variables in form twig template

{{ form }} is the only available variable in form.html.twig template file How can I access raw values from node fields in a twig template? I'm going to use hook_preprocess_node_edit_form for creating ...
0
votes
0answers
5 views

pass the custom module form data in another view tpl file

I have created a custom module to create a form which I want to call it in views-view--webform-results.tpl.php file. I have tried to create a form with all webform submitted values for a field ...
-1
votes
1answer
29 views

Get specific element in site path in twig template [closed]

The current page url is http://website/p1/p2/p3/p4 In Drupal 8 twig, use function to get path p1/p2/p3/p4 {{ set site_path = path("<current>") }} {{ site_path }} The site_path is p1/p2/...
0
votes
0answers
23 views

Load page content with AJAX after being gated

I need to gate a page's content with a form so that the content isn't loaded until a form on the frontend is filled out. I can hook into this form's onSuccess method (all via JavaScript) but I'm a bit ...
-2
votes
0answers
32 views

How to check the machine name of the product type?

I have the TWIG code below that works. It checks that "Produit" is in the name of the product type. My problem : I want it to check the machine name of the product type (not the title of the ...
1
vote
2answers
26 views

Use theme template with specific Views

I have a D8 subtheme of Bootstrap and on the homepage I have 2 Views (2 carousel views). I turned on twig debugging so I could see which template file(s) is (are) being used, and where it starts and ...
-2
votes
0answers
43 views

Current page link is not adding in my custom theme full pager links

I have created a view page showing products with full pager and full pager links are showing currently but current page link is not been added in the pagination links and because of this pagination ...
0
votes
0answers
19 views

How to get the URL of remote video inserted by media field in block or paragraph twig?

How to get the URL of remote video inserted by media field in block or paragraph twig? I am using the paragraphs module to create video galleries from youtube videos. When I use {{ content....
0
votes
1answer
31 views

How can I add CSS variables to the HTML head?

For my site I want to be able to set custom css variables to the sites head. I don't want to add css files just inline css code. In the end I want users to be able to set colors using a color picker. ...
0
votes
0answers
9 views

field widget form element not updating #attributes via #ajax callback

I am trying to do a simple update to a form element in my field widget, I have a start and a end dates in the field widget and I need the start date to be the min date of the end date, so I call an ...
1
vote
1answer
29 views

How to add template suggestions for form elements of a certain form ID?

I'm looking to edit some Twig templates for certain form elements, but I need template suggestions only for certain form IDs. How do I go about that? I currently have the following functions in my ....
-2
votes
0answers
13 views

How do I theme multiple uploaded files?

I want to create a file field where I can upload multiple files but I want to change design of the uploaded file. I want to remove checkbox, I want to display only count of the file instead of name of ...
0
votes
0answers
10 views

Show field conditionally + display each form part in div

I've followed the tutorial in order to create field conditionnaly, but the field is always shown. This is possibly due to the way I'm calling my form ? And if I do as I did in my template, how can I ...
0
votes
1answer
24 views

Adding Count Up module to custom front page

My end goal is to put several Count Up numbers on my custom front page. But I'm having trouble getting it implemented. First, I installed the Count Up library (https://github.com/inorganik/CountUp.js) ...
0
votes
0answers
26 views

Using TB Megamenu, how to close one submenu when I open another submenu?

I'm building a couple of (Drupal 8.9.13 and Drupal 9 based) sites where I use TB Megamenu megamenu module (https://www.drupal.org/project/tb_megamenu) to create the menu. All is working fine on ...
0
votes
1answer
34 views

How to add custom attributes to description meta tag?

I need to add 'class' and 'data-type' attributes to meta tag containing description attribute. I was able to locate the core Metatag module, however I'm unable to find any documentation on how to ...
0
votes
0answers
21 views

CSS is not loading when create a new template node from newly created content type

The issue me having is that i cant able to successfully create a new page from newly create Content Type (if i use existing content types for create node template its working properly). i have tried ...
0
votes
1answer
29 views

How can I style the webform submissions table?

Using Drupal 9 and Webform, I'm unable to find the twig template used to output /contact/form/submissions. Is there a place in the documentation that lists the twig templates? I see there is a View ...
0
votes
1answer
74 views

jQuery dependency on a custom theme is not adding jQuery?

I know that this question has been asked previously many times but any of the solutions are not working in my case so please, I request if anyone can help me with this situation please provide me ...
1
vote
1answer
56 views

Twig: How to show static text in the template to the Anonymous User?

On a Drupal 8.9.13 website, I've removed the permission "View published content" from the Anonymous user. By default, when someone visits the front page, Drupal will then display: Access ...
0
votes
0answers
8 views

How do I fix Bootstrap 3 logo dropping down below navbar

I will be working on a project soon using drupal 8 that has bootstrap 3 installed. so I set up a test server (located here: test server) to start familiarizing myself. I figured out a bunch of things,...
0
votes
0answers
9 views

How to display webform multiple results in a table rather than a list

On the webform page itself (data entry), it's possible to instruct a composite element that allows multiple values to "Display elements in table columns" (under Build » Advanced » Multiple ...
0
votes
1answer
15 views

How to display specific button for certain user?

I have a simple Drupal 7 page with 3 buttons. Page is only accessible by logged-in users. I have 3 roles - role 1, role 2 & role 3 What I would like to do is to show only button 1 when a user with ...
1
vote
1answer
44 views

Why is the CSS in my sub-theme not working? [closed]

I'm a Drupal newbie, but hoping someone can assist. The site was working okay, but I've tried to implement a sub-theme and things seem to have gotten messed up. What I was trying to achieve is to ...
0
votes
1answer
18 views

Twig adds an unwanted 'row' class that doesn't appear in class array

My site theme includes customised templates for 4 regions in the footer, all containing identical code: set classes = [ 'region', 'region-' ~ region|clean_class, 'col-sm-12', 'col-md-...
0
votes
1answer
30 views

Is there a way to see all the available variables inside content?

I am using Drupal 9 with twig files I have a page where in one section I need to show thumbnails of the latest posts. So I created a new view as a block, and placed this block under Content in admin/...
-1
votes
0answers
22 views

How can I add the current node author to JSON-LD tag?

How we can show author name of node in head? I've created a schema html.html.twig file where I need to display author name without input in meta tags in admin. I want to get dynamically. <script ...
0
votes
1answer
24 views

What am I doing wrong in my theme that's breaking CAPTCHA?

I have a bug in my CAPTCHA implementation. When I click the "Get new captcha!" link, it does not refresh the image CAPTCHA. After a ton of research in issue queues, testing and breaking my ...
0
votes
0answers
16 views

What is internalviewpath in html template suggestions

Top of the list of template suggestions for the html template says: html--[internalviewpath].html.twig The internalviewpath part is confusing. Is it a normal path(eg: node/123)? Is it related to ...
0
votes
0answers
12 views

Customizing book-tree.html.twig

I'm looking at the book-tree.html.twig template and I want to achieve two things. I've searched the web and experimented a bunch and have had no luck. Here's the template: {% macro book_links(items, ...
1
vote
1answer
16 views

Pass values to twig file from #theme options

I need to create a select field in a config form and pass values to it along with custom #theme options. Its easy to pass header & row values. But after selecting a value from select box, I need ...
1
vote
2answers
45 views

How to find the url of a media library image field in a preprocess function?

I have a preprocess function that I am using to grab one of 3 profile images. Basically we're replacing a couple stand-alone image fields with a media library reference field. The goal is to display ...
1
vote
2answers
99 views

Twig conditional render if specific field in array of referenced entities contains text

In a Twig template, I'm conditionally rendering a sidebar based on whether custom field content.field_body (Paragraphs entity reference revisions field type) contains any items. {% if content....

1
2 3 4 5
210