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

How to use articles attached images as background of a div

I'm doing my first site on Drupal 8 and I have a problem. I would like you to help me. In fact I'm trying to get the articles attached images as a background for a div created in the page templates. ...
1
vote
1answer
46 views

Get a list of field variables for template code

For Drupal 7, how do I access (or generate) a list of all the field variables available for building a template (for a given content type)? Some context: I used to rely on the (now deprecated) ...
2
votes
1answer
52 views

How do I get the user avatar picture?

I am working on a custom Drupal 8 theme and I am trying to get the user avatar picture on a variable and output somewhere in the HTML. I have created this function to get the name & email of the ...
0
votes
1answer
37 views

How to use Interface Translation for specific text on specific pages only

I need to translate certain text in a twig template to one of several languages, depending on the Language selected for the node being displayed. I've installed the Interface Translation module (...
0
votes
0answers
14 views

Adaptive theme no visible after composer install

Have a prolem installing a theme using compser. composer require drupal/adaptivetheme did install the code in the /themes/contrib but nothing else happen. The required drupal/at_tools module is ...
0
votes
1answer
26 views

Site Branding Block not appearing in regular page--html--twig template

I have a sub theme with the parent theme being the bootstrap theme. I am able to configure the site branding block to show up on my content type pages and that's because my sub theme has a hook which ...
1
vote
1answer
32 views

How to replace a preprocess function entirely?

I need to replace template_preprocess_links with my own preprocess function and I can't find in the documentation how to replace a preprocess function entirely. Here is my current HOOK_theme ...
0
votes
2answers
96 views

Get value from twig tweak without additional markup

I am using the following code to set a variable "tab1visibility" from the twig tweak value for field_hidden based on a block id. {% set tab1visibility = drupal_field('field_hidden', 'block_content', ...
0
votes
0answers
35 views

Site branding block wont appear on contact or user login form

I have a theme and I am able to configure the site branding block to show up on my content type pages and a full-width template I have. This is because I have {{page.branding}} in the template. ...
0
votes
0answers
87 views

How to override/theme suggest webform composite element table?

I have created an implementation of hook_theme_suggestions_table_alter() in my THEMENAME.theme file: /** * Implementation of hook_theme_suggestions_table_alter(). */ function ...
0
votes
0answers
27 views

Obtaining a different language translation of a field in views rewrite twig context

I am using the power of twig to compose a map marker image path based on a number of fields available to a view - content type, object category, object rating etc. (e.g. /icons/cities1.png or /icons/...
0
votes
0answers
27 views

Trying to send data from client (JS) to server (D8) using jQuery.ajax [duplicate]

I'm new to D8 but have some D7 experience. I'm trying to receive some JSON data from the client and process it in my module. I have successfully received (I can break on it in my debugger) the ajax ...
0
votes
0answers
23 views

Stop css file renaming when working locally

I've followed this guide to setup settings.local.php: https://www.drupal.org/node/2598914 And in my custom subtheme I have a stylesheet style.css which is working correctly. However when I look in ...
1
vote
0answers
20 views

Assign template to a view

I am using the latest version of drupal and trying to assign my custom created template to a view. I have created a view with machine name designers and followed this article to create custom template ...
1
vote
2answers
35 views

Customize title template based on page

I know I can customize the template by overriding page-title.html.twig but I'm looking for a way to have more than one title template. in my case, the suggested name form my path is ...
0
votes
2answers
245 views

How to render author custom fields info on comment and node twig template?

I am trying to render the author Full Name and other authors customs fields information in comment.html.twig and node.html.twig. But not any of the fields that I made for users such as "First Name", "...
0
votes
1answer
81 views

Why are my if/else statements in page.html.twig ignored?

in my theme template of page.html.twig (theme is a subtheme of classy core theme), my if statements to render a region or not are completely ignored by twig template engine. The regions (e.g. the ...
0
votes
0answers
94 views

Pass parameter to node twig template via url

The url to display node 100 is <site>/node/100. I want to pass a parameter to this node via the url. For example: <site>/node/100/3. Question: What must I do to get Drupal 8 to see /node/...
0
votes
1answer
16 views

Twig conditions for node/page/view in page-title.html

I am trying to set different classes in the page-title.html.twig based on what drupal is actually showing. The first condition works in a node template, but not in the page-title.html. This is a ...
0
votes
1answer
16 views

How to print author's email address in in node template

I have a content of type summary only visible by the author and administrators. I need to print in my node--summary.tpl.php the author's email address that was set at the account creation. Any idea ...
0
votes
0answers
11 views

Themes' screenshots not visible after 8.6.1 update

Once I have updated the multisite (using composer), all the screenshots images just stopped showing. If I try to access the image directly (using browser) the message is like that: Forbidden You don'...
0
votes
0answers
26 views

Use machine name of blocks from parent theme

I have created a drupal 8 subtheme. I have some blocks that have twig template overrides in the parent theme based on custom block machine names. For example mywackynavbar. In the subtheme, I ...
0
votes
1answer
17 views

Custom form template

So I am recently started working on front-end development, and have started messing around with making my own custom templates for modules. I have been able to get page related templates to work, but ...
0
votes
0answers
112 views

How to use cookies in Twig?

I'm trying to create a conditional twig function in a template I created for my website's home page (page--front.html.twig). Twig can supposedly do this out of the box, but I can't get this approach ...
0
votes
1answer
24 views

Block machine name is in use that is not available

I have a Site Branding block I style in my theme. To do this I give it a specific machine name, in this case: sitelogo On a site using that theme I am trying to create this block but when I try to ...
0
votes
1answer
80 views

How to output multiple files url entities on twig?

I have a file entity field that I can upload multiple files and I'm trying to render or display it inside my node twig template. The code below is what I'm trying to make it display. Tried clearing my ...
0
votes
1answer
25 views

How do I correctly implement hook_bootstrap_colorize_text() to alter button colors in a Bootstrap sub-theme?

I have read similar questions on here, but I'm still struggling for an answer for this. I'm trying to implement hook_bootstrap_colorize_text() to alter button colors in a Bootstrap sub-theme. I ...
1
vote
2answers
98 views

Print view header using the “Twig Tweak” module

I would like to print out the header for a view, but not the rest of the content using the Twig Tweak module. I've tried variations on {{ drupal_view('VIEW_NAME', 'PAGE_NAME', 'view_header') }}, but ...
-1
votes
1answer
25 views

Show content type teaser only if posts available for the content type

I'm displaying a content type teaser view on the front page using Twig Tweak. But I want to show it only if there are posts available. Something like {% if content type has posts %} <h1>...
0
votes
0answers
29 views

Referencing media entity fields

I referenced a media entity image, how can i print d title of the referenced image field. Also I added a custom field I called Credit (field_credit) to the media entity type for image to hold ...
0
votes
1answer
17 views

Lost CSS when authentifification

I made a custom theme based on bartik. In this custom theme I add just one CSS file and a very simple specific view template file. When I am connected with a user with 'Administrator' Role all is OK....
0
votes
0answers
260 views

{{ directory }} in Twig template in base theme breaks subtheme

Given a base theme called parent that is a child of stable, and a sub-theme called child whose base theme is parent, a Twig template implemented in the parent theme renders the wrong value for {{ ...
2
votes
1answer
58 views

Avoid random number cached in preprocess hook

I have a random set of images that appear on the homepage which needs to show each time the page is refreshed. My holding page was doing this comfortably in PHP, but since building the whole site and ...
0
votes
1answer
128 views

Twig error “Uknown image_style filter”, but the filter isn't missing

I'm migrating a site to a new host. On the front end, I see... Twig_Error_Syntax: Unknown "image_style" filter. in Twig_ExpressionParser->getFilterNodeClass() (line 57 of /var/www/prod/web/themes/...
1
vote
1answer
33 views

Create Custom Date Formatter for Date Posted Field

I followed a very helpful article by Antonio Benitez that gave some example code showing how to create a custom date formatter for date fields (How To Create a Custom Format for a Date Field). The ...
0
votes
2answers
26 views

Adjusting Height of Panel Columns using CSS [closed]

I am using panel-2col-brick to make a 2 x 2 information block. The HTML structure of the page is as follows <div class="panel-display panel-2col-bricks clearfix"> <div class="panel-panel ...
0
votes
2answers
43 views

How to reformat HTML output of format?

I have looked for days and cannot find an example of what I need to do. I wish to reformat the HTML output ckeditor uses for blockquote. CKEditor output for quote: <blockquote><p>...
0
votes
1answer
37 views

Set value to specific custom theme setting

I noticed that I can get a specific theme setting like so theme_get_setting('myvar','mytheme'); but I don't see a way of actually setting a setting. Something along the lines of theme_set_value('...
0
votes
1answer
34 views

How to set a custom class to submenus

I am working on sidebar menu in a Custom Drupal 8 Theme. I am trying to set a class of sidebar__menu--submenu-1,sidebar__menu--submenu-2, sidebar__menu--submenu-3 and so on depending on the level of ...
0
votes
0answers
21 views

Template suggestion does not work

By debug, these are the suggested names: FILE NAME SUGGESTIONS: * panels-pane--fieldable-panels-pane-top-hero-content.tpl.php x panels-pane--fieldable-panels-pane--uuid-00524104-9c1e-4ee7-a896-...
-4
votes
1answer
32 views

show picture type managed_file not showing in twig [closed]

I am using managed_file in Drupal 8 for my custom module , i create a form has type managed file $form['config_page']['picture_ads'] = [ '#type' => 'managed_file', '#title' => t('Picture ...
0
votes
0answers
35 views

Can't get correct sequence and link to file in preprocess swiftmailer

I'm trying to pass Drupal 8 core Contact form data to a custom designed Swift Mailer template. The way I'm trying to do this is by getting all the fields dynamically to the template. function ...
0
votes
1answer
51 views

How to use HTML in a webform component's title?

We have a checkbox which's title should have HTML (<sup></sup>) but its rendered as text rather than HTML. How to use HTML in a webform component's title?
0
votes
0answers
27 views

how to not display a sum with value 0 with views aggergation plus module

I'm using views aggregation plus module, doing group and compress from taxonomy fields and haveing a columns sum action, how can i hide sums with zero value? views conditional module do not have any ...
0
votes
1answer
29 views

Custom form from scratch in template

I have a paragraph that I fully themed into a contact form with the necessary tags etc... Now my question is: How do I add the actual functionality to this? Because right now it's just plain html in ...
0
votes
0answers
14 views

Issue with color module preview

I am having some issues integrating the color module into my custom D8 theme. I can create a custom set of colour palettes that can be customized on the settings screen. I can modify the layout of ...
0
votes
2answers
30 views

Best way to place hard coded link in template in multi lingual drupal 8

My website (drupal 8) was first in one language. Now I switched to multi langual. Most of the settings i did find (translate content, webforms, strings,...). But at the moment stuck on the hard ...
0
votes
1answer
21 views

Template suggestion don't work with a custom menu link (custom route)

In a module I have created a custom link by creating a custom route inside the mymodule.routing.file.yml and the mymodule.links.menu.yml file. In my theme.theme file I have defined a hook_page_alter ...
-1
votes
1answer
29 views

How do I print the variable “activeLangcode” in a paragraph twig template?

I tried to get the value with (what didn't work): {{ paragraph.activeLangcode }} {{ paragraph.activeLangcode.value }}
0
votes
1answer
38 views

Print a View Field in Twig

I have to convert the following D7 to D8 in my view twig file. I tried the following but its not working. D7 Code : <?php print $view->result[$id]->field_field_document_upload[0]["rendered"...