We’re rewarding the question askers & reputations are being recalculated! Read more.

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
1
vote
1answer
26 views

How to modify the D7 user login page html to remove the register and new password options for non-admins?

So, I'm maintaining a Drupal 7 site for which we recently switched the users over to SSO through a third-party OAuth provider. The implementation isn't fancy, but added a login link to what I assume ...
0
votes
0answers
38 views

is it possible to set a twig in routing.yml?

I am working with Opigno, which may be helpful to know. My end goal is to have my own twig file for the page that shows this information from the module. Here's the routing.yml entry: # Module ...
-1
votes
0answers
20 views

Calculate number of days between two date fields in Webform

I am using Drupal 8.7.6 + Webforms 8.x-5.4 I have two date fields in a webform and would like to calculate the number of days between them using Computed twig Please help
0
votes
1answer
20 views

CSS and JS 404 On Admin Site Only - New Install [closed]

This is a new server build... me@server:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic Apache... me@...
0
votes
1answer
36 views

How can I have profile edit pages displayed in admin theme?

Drupal 8- How to use admin theme for user profile edit page while editing the profile by an administrator. Example: when admin takes the URL: www.mysite/profile/{id}/edit (This is the URL you get ...
0
votes
2answers
20 views

How do I print out a embed video?

I have a paragraph which can either contain an image or a video. When I let the output just come out in {{item.content}} the actual youtube iframe is output. However when I start parsing things to ...
0
votes
0answers
15 views

Why are the Layout Discovery core layout templates overriding my custom layout templates?

I've defined this layout in a [mymodule].layouts.yml file; layout_twocol_section: label: 'Two column' path: layouts/twocol template: layout--twocol library: [mymodule]/twocol class: '\...
0
votes
1answer
20 views

Adding an extra class to the last element of the navigation/tree menu

For one of my projects, I have to create a tree menu, with parents and children, that would be used to navigate through the website. The parents are collapsible. Below is the twig file that I am using ...
0
votes
0answers
17 views

Autoplay variable in settingforms

I am working on slider module in Drupal 8 using jQuery library. But I have a little problem. I use default option/plugin of jQuery library like "autoplay": {"enabled": true, "direction": "ltr"} in ...
3
votes
1answer
94 views

How do I make the same variable available to all my theme files?

In mytheme.theme I have the following: function mytheme_preprocess(&$variables) { $current_path = \Drupal::service('path.current')->getPath(); $result = \Drupal::service('path.alias_manager')...
0
votes
1answer
38 views

How do I compare two strings in a template file?

The template file I am using contains the following code. foo is '{{ foo }}' item.url is '{{ item.url }}' {% if item.url == foo %} equal {% endif %} I was expecting this code to output foo is '...
0
votes
1answer
19 views

How to show status messages in modal window?

Here, I tried many different ways to show status messages in pop window but was not able to get success in any way. So, basically i want to show all the status message of site in modal box whether it ...
0
votes
1answer
31 views

List of replacement tokens?

Where can I find a list of the available tokens, so I can write things like {{ node.title }} in my templates? The documentation says the best way to find a list of them is to use this: https://www....
0
votes
1answer
42 views

How can I loop through all article content types and get the content of each

I created a new article content and am overriding that by creating a template for it (ie: node--4.html.twig). Then inside this template, I want to loop through all nodes that belong to article ...
2
votes
1answer
23 views

How can I theme the markup for the labels in a set of radio options on a specific form item?

Given this form item defined in a custom module; $form['my_items'] = [ '#type' => 'radios', '#title' => $this->t('Items'), '#options' => $optionsSet // array of options pulled from ...
0
votes
1answer
11 views

use a view template that exists for content view search from database, to a solr indexed fields view, so as to have visually the exact same result

In Drupal 7, i have a view named say default-view to display results. I have disabled the default search and enable module 'Search API' and Search API SOLR (used for Backend) to perform search in ...
-2
votes
1answer
27 views

How can I position two elements next to each other in the admin area?

how can I position two elements next to each other in the admin area of Drupal 8.6.10? I want to position the element Channel Additional next to the element "CHANNEL". So that Channel Additional is ...
-1
votes
1answer
62 views

How to add separate class to menu link using hook

I want to add custom classes to the anchor tag in the main menu. I implemented hook_preprocess_menu(), but it assigned the classes to the <ul> tag and I want to add the classes to the <a> ...
0
votes
0answers
21 views

Template suggestions showing up in Twig Debug, but not pulling in files

I am using some preprocesses to add template suggestions for Views that are a child of a Paragraph type. function riverside_theme_suggestions_views_view_alter(&$suggestions, &$vars) { if (...
0
votes
1answer
15 views

Resizing a block on a drupal 7 website

I have three blocks A, B and C on the home page on location Content Bottom. I have another block D I want to place at location A+B and I want to keep C at the same location. I will move A and B to ...
0
votes
1answer
27 views

Taxonomy Terms More than one level and Clean Class throws error

I am using clean_class and clean_id in twig. It was working with Parent Taxonomy Terms fine, but when I use Child Taxonomy Terms and try to render to Twig Template, I get this error message: ...
0
votes
1answer
21 views

Combining Date Start and Date End in Drupal 8 Views Block

I am new to Drupal 8 Views - How do you concatenate Event Start Date Sept 1, 2019 with Event end Date ie: Sept 4, 2019? The end result is they just want the Month and Day to show up like this Sept 1-4....
1
vote
1answer
23 views

what are the css files with question marks - like modules/system/system.theme.css?pywps6u?

I am new here, starting to find my way around a Drupal site I inherited. I am trying to work out if I can safely ignore all the @import css files with question marks like system.theme.css?pywps6u . I ...
0
votes
1answer
27 views

Content appearing under specific tabs

My site will be divided into multiple areas, or tabs, for example, Music, Politics, News, etc. Under each tab I'd like to display a different sidebar (my sidebar will contain menus representing ...
0
votes
2answers
36 views

Hook theme path to template in a folder

For my template I need to point to a subfolder in templates folder: templates/sub-folder/my-wall1.html.twig, the file is there, but nothing works. What are the rules? translate minus (-) to ...
0
votes
0answers
12 views

How to render two paragraph fields behind each other in a slick slider?

In my node content type I have two fields which containing different kinds of paragraph types. (How) is it possible to render the paragraphs of the two node fields in one slick slider behind each ...
0
votes
1answer
19 views

hamburger menu moved after update

We use we-mega-menu. After performing an update the mobile (hamburger) menu changed its alignment to the left as well as some other things I was able to fix the other things but I can't seem to figure ...
-1
votes
1answer
30 views

How to override the default search block and make a button with Font Awesome?

I want to override the default search block of Drupal and create a button like the image below: However, I do not know how to do it. I have tried using hook_form_alter as well but it is not working: ...
1
vote
0answers
29 views

Get readable content array keys when using Layout Discovery and layouts templates

I noticed when using Layout Discovery on nodes display modes, the content array looks like this. Compared to the content array without using Layout Discovery which looks like this : A counterpart of ...
0
votes
0answers
11 views

Can you use views_embed_view in hook_preprocess_node function?

I'm trying to do something like this for a trending blog post sidebar: $variables['trending_articles'] = views_embed_view('trending_articles', 'block'); But when I do it renders the entire page with ...
0
votes
1answer
29 views

How to remove Home title from the home page?

There are several posts on a similar question. Despite that, I couldn't find the best way to resolve it. Display Suite is installed but don't see option to turn off page title. Our home page content ...
0
votes
1answer
53 views

How to access to form field in views-exposed-form.html.twig (exposed filters)

I am trying to customize the template for the exposed filters of a view. I have created the views-exposed-form.html.twig and Drupal loads it fine, following How do I theme exposed filters?. For now,...
1
vote
1answer
41 views

For each image uploaded in a node: get the url

I'm begining with Drupal 8 and I want to get the url of the photos in the content I create to display them. The context is : a photograph upload pictures for a customer. This customer can see it on a ...
0
votes
2answers
41 views

Cannot get role information in twig file

I cannot seem to get the role of the current user in my twig template. I have tried the following: {{ user.getRoles }} {{ user.hasRole('content_administrator') }} and neither return anything. ...
0
votes
0answers
31 views

Getting white screen in Login /user and the page content

I was recently editing a website with Drupal 7 installed, and was integrating twitter feed. I created a block twitter_feed_block and assigned the block to the content section of the front page. It ...
0
votes
1answer
10 views

No install link for sub theme of sub theme

In my D8 site I have Magazine Lite, a sub theme of Classy. Magazine Lite is installed. In web/themes/custom I have a theme installed that in its .info.yml file names Magazine Lite as its base theme. ...
0
votes
0answers
35 views

Get relative path to node by title in a Twig

Using Drupal 8: I would like to get the relative path to a node using the Title field. Is this possible? All the Twig documentation I've found uses the node ID, for example: <a href="{{ path('...
1
vote
1answer
27 views

Can we output individual form items within a Layout?

We are using Layouts (via mytheme.layouts.yml) to create regions for our Node Edit forms. This looks something like... edit_nodelayout: label: 'Edit Node Layout' category: edit path: templates/...
0
votes
1answer
53 views

twig problem, how to override base templates?

I have installed Bootstrap and the Radix theme, and created a sub-theme, which is all working OK. But I am unable to get some of my twig files to override the base theme twig files... The file themes/...
0
votes
1answer
12 views

Date and links formatting in node template

Drupal 8.x I have 2 quick questions. I have the following node template node--briefing--teaser.html.twig <div> <span>{{ date }}</span> <span>{{ label }}</span> &...
0
votes
1answer
28 views

How to display a field of the parent store in my module?

I have a Drupal 8.7 site with the Drupal Commerce 2.14 module. I created a marketplace (several merchants on the same site). In the store type, I created a "Text (formatted, long)" field with the ...
1
vote
2answers
16 views

How to detect Panelizer use in template_preprocess_html()?

In Drupal 7, you could look for $node->panelizer or use page_manager_get_current_page() to check if the current page uses a panelizer layout. How do you do that in Drupal 8? I'm trying to add a ...
0
votes
1answer
18 views

Can we display region label from Layouts?

We have a MYTHEME.layouts.yml file which defines regions... layout label: 'Layout Name' path: templates/panels template: layout-template default_region: theregion regions: theregion: ...
1
vote
1answer
44 views

How do I add default header and footer regions to my site?

i have added regions in my theme.info file. now i want to add default header and footer with logo in all the pages of my site.This is my page.html.twig <div class="layout-container"> <...
0
votes
0answers
22 views

How to retrieve information from the parent store of a product?

I have a site with Drupal 8.7 and Drupal Commerce 2.14 I created a template for my stores : commerce-store--professionnel--full.html.twig And I added this code : <div class="col-xs-12 col-sm-12 ...
0
votes
0answers
17 views

TWIG Template file passing variables

Basically I'm creating a bridge status monitor. I've built this within views. There are 3 main options, Open, Closed, Restrictions (with conditional logic showing these in the form). I managed to ...
1
vote
0answers
66 views

How do I add a script just above the closing body tag?

How do I add a script on Drupal 8 site/app just above closing body tag? Vendor provided some JS in the following form: <script> ... code </script> Asked me to place immediately ...
2
votes
1answer
43 views

How do I return a Twig template inside the build method of a block class?

Am new to Drupal and this week I learned quite a bit about module development, and for today the case is: For my new module, I create a custom block that renders a markup, and from the folder ...
0
votes
0answers
28 views

How can I theme a paragraph on admin edit pages?

I'm struggling to override the template on the admin interface for a content type. I'm going to need to do several modifications to the edit form to meet the editor's requirements, however, I seem to ...
-1
votes
1answer
68 views

How can I access individual form elements for theming?

I have overridden the default user login form in Drupal 8 using a different template in my sub theme, but it isn't of much use because when I access it in twig template, all I can do is <form {{...