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
1answer
10 views

How to move block from a region inside of hook_preprocess_node?

I have added mycustomblock to the header region in our settings (/admin/structure/block). We are using the standard content block and displaying that in the Content region, which is displayed below ...
0
votes
2answers
35 views

How do I print individuals fields in block.html.twig when is a node in a block?

How do I print individuals fields in block.html.twig when is a node in a block? The template is working fine. I can hard code some random text and it is displayed. I just can't display the field ...
0
votes
2answers
20 views

Views footer include twig

Is there any way to include an if condition in views footer. I have to check the total rows {% if [view:total-rows] > 6 %} <div class="btn">View AllEvents</div> {% endif %} But this ...
-2
votes
0answers
25 views

Custom pages for separate taxonomy terms [on hold]

I want to design different pages for different categories. For example, if I have 2 categories with machine names One Two I want to have pages like this page--taxonomy--one.html.twig page--...
1
vote
1answer
38 views

How can I display the block title when rendering a block using Twig Tweak?

Block title when using twig-tweak plugin, not showing. I created a block-type view. And using the module's cheat sheets, I called: {{ drupal_view('views_name', 'block_1') }}
-1
votes
0answers
16 views

HTTPS domain doesn't display PDF's in pdf.js and same with embeded videos. How to fix that? [on hold]

When the site is set to HTTP all pdf files and embedded videos are viewed in pdf.js viewer and video.js viewer. When I change the domain to HTTPS these viewer doesn't display any files. When I inspect ...
0
votes
1answer
24 views

Why would all theme background colors disappear after moving to different server?

A site using MAYO 7.x-1.2 was moved from a Windows IIS to a Linux server. Shortly thereafter, all background colors defined in MAYO settings (and also any custom CSS) have disappeared. Also gone is ...
0
votes
1answer
54 views

How to add field content as class in Twig?

I want to add the content of a field (i.e. "workshop") as a class in field-html.twig i tried {% set classes = [ 'field', 'field--name-' ~ field_name|clean_class, 'field--type-' ~ ...
0
votes
0answers
47 views

Create a View to reference content, get paragraph field and influence how it is rendered?

I am trying to create a Paragraph type that lets a user specify a node to reference, and a couple of checkboxes that influence how content from that node is rendered. I can create a view that gets me ...
-1
votes
0answers
26 views

Help finding a contributed theme or module allowing block overlays [on hold]

I'm trying to obtain a well-looking page. In particular, I'm struggling in order to replicate the overlay among several blocks: banner on top of the owl-carousel, partial overlay of search form. I ...
0
votes
1answer
37 views

Need help with twig test template

I'm trying to create a test twig template in drupal 8, I followed "Create custom twig templates for custom module" from their website but it's not working for me for some reason. This is what I have: ...
0
votes
0answers
15 views

How can i get node type in template.php [duplicate]

I want to configure breadcrumbs depending on the node type. How can I get the node type in a function theme_breadcrumb in template.php? I try it, but it doe't work. function zen_breadcrumb($variables)...
0
votes
0answers
10 views

Theming the multiple file widget output

I'm trying to theme the output of the a file upload button in my theme... It's a multiple file upload button. Currently core outputs this as a table with draggable icons... Is there a way to render ...
0
votes
1answer
37 views

How to render views link field in twig?

I have created a view that has many fields including a link field. I am using a twig template. my view twig name is views-view-fields--dashboard--block_3.html.twig It works nicely but I need to render ...
-2
votes
0answers
23 views

How do I show related content in custom template? [closed]

Hello I am having problem displaying related content (for example related articles for article content type) in custom template. I've found how to do it in view, but have not found anything how to ...
1
vote
2answers
38 views

Using variables in an expression

I am checking for a specific block in a specific theme region. {% if page.header_first.blockmachinename %} // Show stuff {% endif %} This works when I have the right machine name. But I want to ...
1
vote
1answer
46 views

Custom Entity is only showing via admin theme

I implemented a custom content entity with Drupal console. By default the routing is done in JobListingEntityHtmlRouteProvider.php file. I am getting a standard path such as /admin/structure/...
1
vote
2answers
54 views

Detect browser in preprocess function

My goal is to render a warning message to IE 11 users, prompting them to use a modern browser. I'm a bit of a noob, but from what I understand, it's possible to detect a user's browser using a ...
0
votes
0answers
30 views

How to use {{string}} to assign a value to an attribute in input tag (Twig Template)

I want to do the following: {% set var= "string"%} <input name='{{var}}' /> All drupal does is to ignore the tag in gerneral. If i set the tag like this everything is fine: <input name=...
1
vote
1answer
23 views

How can I print a referenced media extension

I am working in the node template. In my content type I have a referenced field to media called 'field_event'. I created a new media type called 'document'. Inside document there is a file upload ...
0
votes
0answers
30 views

How to print in twig a Flag Link field

I have a views-view-unformatted.html.twig template working fine where I can print fields from a view of nodes. Example: having i = 3, print row number 3 title {{ rows[i]['content']['#row']._entity....
-3
votes
1answer
33 views

How to change the length of field from 255 to ilimit?

i have a field in web site but lenght limit this is field is 255 , but client wants to puts more caractere to that field i want to change field from 255 to ilimit . any help please
-2
votes
1answer
22 views

How can I display tags on one line

How to change the below output of a drupal article Tags display with bootstrap theme To something like this which is displayed in stackoverflow below any questions Is there a ready made module ...
0
votes
1answer
17 views

How to theme all pages after a certain url

I'm using Drupal 8.7.8 I would like to create a new twig theme file for all pages that are after a certain URL. For example: example.com/example/this-page "This-page" is what I want to create my ...
0
votes
1answer
13 views

Have Views based Taxonomy Term page use term description for title

I am using a view to replace the standard Taxonomy Term page (turned on the standard one in Drupal 8.x). I want the Title of the page to be changed from the Name of the term to the Description of the ...
0
votes
0answers
6 views

how to display field in Hook_preprocess for the template file

I am trying to display following field to the tpl.php file. However, I do not know how to display this field. $form['ExStart'] = array( '#type' => 'value', '#value' => $overallstart, )...
-1
votes
1answer
59 views

Add a css class to the active link then remove it when becomes inactive

I know this question might not fit here but I am afraid that I am doing something wrong related to Drupal since it is my first time with JS code and its implementation into Drupal core. I have placed ...
-1
votes
0answers
14 views

Exposed Filter “Apply” and “Reset” Button Styling went away after changing Views template file

I modified the views-view.html.twig file to display the header section so that I could have the "Result Summary" at a desired place in my View. I got my answer on how to change the header position on ...
1
vote
0answers
26 views

Is there a way to add CSS classes to Paragraphs Add More submit buttons?

I'm using the buttons method to add more paragraphs and am styling the buttons via css in a custom module. I'm setting paragraph icons as background images for each button so an editor can visually ...
0
votes
0answers
21 views

Extend twig template from differnt theme (parent)

I created a sub theme of the bootstrap theme. In one of my twig-files I would like to extend a twig template from the parent like this: {% extends '@bootstrap/menu/main--main.html.twig' %} This ...
-2
votes
0answers
38 views

Unexpected error occur when I render a views field in views twig file [duplicate]

I have created a User Profile block view and have an HTML template for this. The view is working normally without using a custom template but when I create a custom twig file name is views-view-fields-...
2
votes
1answer
33 views

Checking for an Acquia Environment variable

Trying to check for an Acquia cloud environment variable in my twig template, but its not working in Dev or in Production. Similar question is answered here, but I still can't get the twig syntax ...
1
vote
1answer
63 views

How to call hook_theme_suggestions_HOOK_alter twice, if node is shown twice?

What I want to do is show the contact person responsible for a language in two different regions simultaneously, but with different twig templates. I therefore have two regions: footer and sidebar I ...
1
vote
1answer
27 views

How to create node twig template suggestions for one content type?

I need to create a node twig template that is just for the basic page content type that based on a custom field on the content type. We have other content type like Article, Blog, Products that do not ...
0
votes
0answers
33 views

Get user field value in Twig

I have a node--contentype.html.tiwg as well as a node--contentype--full.html.twig file in my template. In this files, I can get the nodes fields without any problem via {{ field.content.field_name.0 }}...
0
votes
2answers
26 views

how to prevent a theme from using templates of a sub themes (placed inside the parent theme dir)?

my folder structure looks something like this: 📂 themes └─ 📂 foo ├─ 📂 bar │ ├─ 📂 templates │ │ └─ 📄 node.html.twig │ └─ 📄 bar.info.yml ├─ 📂 templates │ └─ 📄 page.html....
-2
votes
1answer
31 views

Twig define dynamic generate variable

I have field names: field_en_image field_sv_image node_lang is set as a variable in the .theme file under _preprocess_node hook. I want to print the field dynamically in the twig template file ...
-1
votes
0answers
11 views

submit button does not respond after creating custom theme in drupal 6

I am trying to implement a custom theme. However, after creating custom theme my submit function stop inserting data into the database. Any suggestions would be appreciated. hook theme-sdbpireq....
0
votes
1answer
28 views

How to display custom block anywhere in a div?

I am creating one drupal 8 theme based on bootstrap framework, for banners I created one custom block, named as 'Homepage banner', without creating any region, how to display this on my homepage ...
0
votes
1answer
16 views

How to use Views Photos Grid module with custom minimal theme

I use Views Photos Grid module and it shows the results correctly with Stark theme. However, it shows all the images stacked in only place in my custom theme. I do include modules css and js files: &...
0
votes
0answers
40 views

How can I preprocess a node field value to make it accessible in the template level beneath field level (video template inside file field)

I am using the Video.js (HTML5 Video Player) module and I would like to add an image for the poster by loading the URL of another image field in the same node (without modifying the module itself). ...
0
votes
1answer
34 views

Dynamic results label for Views with Taxonomy Filters

I'm using Drupal 8 Views with Better Exposed Filters to filter a custom content type by two custom taxonomy vocabularies. Results are filtered by: Content: Published (=Yes), Content: Content type (...
2
votes
1answer
39 views

Why do I get Template “@bartik/block” is not defined?

So I've created a small subtheme called bartik_graphql. It just overrides the 'Powered by Drupal' block. Besides it's bartik_graphql.info.yml file it has a templates directory containing one file ...
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
33 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: '\...