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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
0answers
11 views

Migrating from php5.6 to 7.1 [duplicate]

I 'm trying (admin - no developer) to migrate from php 5.6 to 7.2 on an 6.16 Drupal implementation. This migration is necessary to be able to migrate afterwards to Drupal 8. This Php migration doesn't ...
0
votes
1answer
22 views

Weird behaviour when customising views-view-unformatted.html.twig with grouping

I'm trying to override the views-view-unformatted.html.twig template by an unformatted view that includes a hidden Grouping field. The default template includes this code: {% if title %} <h3 ...
-1
votes
0answers
23 views

Using twig how can iterate and store loop values in a variable?

I'm trying to figure out how I can store all the values from a loop in to a variable so that I can access or use it anywhere on my twig template. Fetching the taxonomy terms and trying to output the ...
0
votes
0answers
24 views

Render Field Collection's Text (formatted, long) as HTML

This is what I have right now {% for hp_quote in node.field_home_page_quotes %} <div class="quote-content"> <p class="quote-copy">{{ hp_quote.getFieldCollectionItem()....
0
votes
0answers
28 views

Theme function ignored until cache flushed multiple times

I'm using the ShareThis module to power my sharing links on a Drupal 7 site, but I don't think my question is specific to this module. I want to modify the link that's shared and sharethis provides a ...
0
votes
0answers
20 views

How to customise the content of the search results page

There are twig templates available for customising the individual results items, and the pagination, however, how can you customise the content on the search results page before the item list. For ...
0
votes
1answer
31 views

Comments filter by Last in Twig

I try to render the last comment from a list of comments. I try {{ comments|last }} ---> no result. Then {{ comments|reverse }} ---> this render them Then {{ comments|reverse|first }} ---> no ...
0
votes
0answers
27 views

Taxonomy page variables giving empty values

I have a taxonomy page set up using taxonomy views. I added the page--taxonomy.html.twig template, but the output of {{name}} and {{content}} is an empty string. I also tried using the page--taxonomy--...
1
vote
0answers
44 views

Passing a value from a custom controller to a specific template

I'm trying to update the user profile template with information from a custom module. For example, in the controller, I am using the following code. $build ['send_data'] = array( '#theme' => '...
0
votes
0answers
24 views

How to get all vocabularies in a taxonomy retrieved from a referenced field?

I have a taxonomy that I am getting in the page twig file after referencing a field from the node object. The twig file is a page for a content type, i.e. page--content-type.html.twig. So node....
0
votes
0answers
13 views

How do I format/style the Search API form input style to non stacking

I have been experimenting with the Search API module but after a long day, I still cannot get my search input form to have the input and 'Search' button to sit next to one another (both desktop and ...
1
vote
1answer
33 views

Why is the page content always rendered after blocks displayed on the same page?

I have a Static Page node at, say, /my-page. It has a title and body. I have also placed a block (pointing to a View) in the "Main content" region, at the very bottom of the list. However, when ...
0
votes
1answer
17 views

Override formatting for paragraph edit view

I have a paragraph type defined as two fields, which are Person and Role. I can customize the structure of the paragraph fine to view. However, I am stuck in editing how the form elements sit in the ...
1
vote
1answer
20 views

Sharing the same templates by importing PHP files: Where should I store those PHP files?

I want to be able to just edit standard PHP files which are then imported into many themes. I feel like a module is an overkill, so I'm happy with just a folder of files.
-2
votes
2answers
49 views

How do I upload a background image?

I want to insert a background image in the IBM API Connect theme. I first googled, and I found how to insert an image in a node; then I downloaded the Background Images, the Background Images ...
0
votes
2answers
14 views

How do I add an image field to my node.tpl.php template using render($content['field_example'])?

I am creating a Bootstrap sub-theme and want to customize my node.tpl.php template. I have an image field with a machine name of 'field_poster'. According to the default node template: $content: An ...
1
vote
1answer
20 views

{{ language }} variable not available in block template

We are trying to generate a language dependent link in a custom block we created though the UI and placed it into a region. If I {{ dump(language) }} in page.html.twig, I've got it there. But not in ...
-2
votes
1answer
35 views

How to create a dynamic front page [closed]

I have created page--front.html in drupal 8 custom theme then how to make dynamic this page section ? where I write custom code. i.e. how to showing slider images to which is added in admin side. ...
0
votes
0answers
13 views

How to use Drupal.displace inside Drupal.behaviors

I want to scroll down the page at page load time to bring a feature that might be below the fold into the viewport. Script works fine for anonymous, but for authenticated user, Toolbar module overlays ...
0
votes
2answers
39 views

unable to force JS library to HEAD

I've read the main docs about this but find it lacking context. This did better job of explaining and it seems it should work. How to force a JavaScript library to load in the <head> of a Drupal ...
0
votes
1answer
28 views

Getting Node Field Values from Referenced Entity within a Paragraph

I'm trying to create a featured content paragraph type, however, I can't figure out how to grab anything from the referenced node that is in my entity reference. I don't see any twig documentation ...
0
votes
2answers
31 views

Twig: “for” does not display variable content without first displaying all variable content

I have found a very strange behavior. My variable related_nodes contains a list of nodes. How it is displayed by Kint: related_nodes array(10) '#sorted' => boolTRUE '#pre_render' => array(1) '...
-2
votes
1answer
30 views

What is the welcome page file that we inspect? [closed]

I want to edit the html of the Front page of drupal 7. However, i don't know which file is it ? What is the name of the front page/ welcome page file that when we inspect we get it. I previously ...
-3
votes
1answer
36 views

Where to find template.php file in my drupal 7 [closed]

Normally i make changes in the CSS part of the pages and use CSS Injector to modify the CSS. However, now i want to make changes in the HTML code so i figured out it can be done through template.php ...
0
votes
2answers
12 views

Test domain access module

I have used the domain access module to create 2 domains that our business use, and I wanted to test them in the CI cycle. How do I test them in CI that they are active and each domain uses the ...
0
votes
0answers
27 views

How can I preprocess node with Display suite layout and Bootsrap sub-theme? [closed]

The title says it. I have Drupal 8 with Bootstrap subtheme and Display suite module for node layouts. I am using for example ds1_col layout for a node type. I know that DS has its own preprocess ...
0
votes
1answer
23 views

Field template for display mode of referenced paragraph

I have a custom field field_platform (referencing a the custom paragraph type platform) and a template for my field: field--field-platform.html.twig. Is there a way to override this for a specific ...
1
vote
1answer
22 views

Preview template for node with custom template?

I have a custom content type, 'Article with Header' for which I have a custom twig template, 'page--article-with-header.html.twig', which manages the layout for this content type. When I preview the ...
-1
votes
0answers
26 views

AJAX HTTP error: Dependent dropdown list not working in Drupal forms API using PHP

I need to use a dependent dropdown list. My code is as follows: $selected = isset($form_state['values']['channels']) ? $form_state['values']['channels'] : key($options); $form['channels']=array( ...
0
votes
0answers
17 views

Custom template for registration mail

I have a custom template that I use to send all my mails, and I want to use it too for the registration and password reset mail. I only know how to use hook_mail_alter(), but it seems that hook allows ...
-3
votes
1answer
18 views

What is the most recent and stable version of Zen theme? [closed]

I am searching for the most recent and stable version of the Zen theme. Any help would be greatly appreciated!
1
vote
3answers
89 views

Allow markup inside drupal 8 Link function

I always try to use the core functions for linking in drupal, but I'm not able to add html markup like <a href="..."><span>Link text</span></a>. Any ideas?
0
votes
0answers
26 views

$ is not defined [duplicate]

I am having hard time trying to make $ work with my javascript. This is the line of code I am using. If i use jQuery, it works as expected but if I use $, it says $ is not defined. Any advices? if (...
0
votes
1answer
23 views

How to append css class to menu link?

We have a custom menu mymenu where we use menu_link_attributes to add CSS classes per menu link. The problem we are running into is that we have one generic css class that we always want added ...
2
votes
2answers
87 views

Display a Media Entity Image from other (referencing) node in a Twig template

Seems that all found in the Internet does not work for my case. :/ In general, I need to display an Image and a Project, referenced by the node that has a reference field to my node. I have: a node ...
0
votes
1answer
52 views

Pass custom variable to block.html.twig

I have a customer who requires the correct set of responsive classes for his block in a given theme depending on its position and count. In my theme_preprocess_page(&$vars) I can identify the ...
0
votes
0answers
21 views

JS not completely working for anonymous

some of my jquery not isn't working when the user is not connected, I have this : Drupal.behaviors.basic = { attach: function (context, settings) { (function($) { $(window)....
0
votes
1answer
40 views

Why does js click function run multiple times?

I'm creating some accordion functionality for fields and paragraphs using a combination of twig templates and a custom JavaScript file. Everything prints as expected and the basic accordion ...
1
vote
1answer
69 views

Layouts versus theme templates

When I add a layout to my theme using .layouts.yml, it will show up in the display settings for various entities (for example, paragraphs and blocks). I can then set the display to be of a certain ...
-1
votes
1answer
22 views

how to render a contact form in a twig file [on hold]

I am trying to render a contact form in a twig file with the hook "redbook_theme_suggestions_page_alter". I am new to Drupal 8. Any help will be appreciable.
0
votes
0answers
19 views

How do I use twig replace filter on link?

I'm new to Drupal and I'm trying to replace language switcher text links to flags. So I created links--language-block.html.twig template file in my theme, which is exact copy of core theme template ...
-2
votes
0answers
36 views

How can I Defer offscreen images? [closed]

How can we defer offscreen images manually? I have used this module https://www.drupal.org/project/defer_image It provides the field formater defer image which can be applied on images uploaded ...
1
vote
1answer
20 views

How to load library only on one twig template?

We have a custom theme, mytheme where we have the following library for the header-fix. I have also added {{ attach_library('mytheme/header-fix') }} to only one twig template block--myblock.html.twig ...
0
votes
0answers
9 views

Views title transilation

I face problem when I translate views title. because when I create view with default language then add translation of view and write translated title then flash cash the view title in breadcrumb will ...
-2
votes
1answer
33 views

Autoload next page while scrolling to the bottom [on hold]

I am looking for a way to automatically load the next article once a reader has scrolled to the bottom of the page. Something similar to what this wordpress plugin is doing. So I understand that the ...
0
votes
1answer
47 views

how to add class to {% block content %} in twig

Here goes my drupal 8 code, so basically block.html.twig is extended to block--mytheme-sitebranding.html.twig. Now I want to add a class to this: {% block content %} {% if site_logo %} <a ...
0
votes
1answer
32 views

Add active class to We MegaMenu

I am using We MegaMenu. The menu does not have the active class. Is there any way we can add the active class to the active menu item?
0
votes
1answer
17 views

Table doesn't render on ajax command

I have a function that returns a render array for a table; private function _files_table($job_id){ $files = $this->_query(" select * from JC_Documents_Recent_Revisions ...
2
votes
0answers
19 views

External CSS file is not being loaded

I added an external CSS to my theme. When I look at the source code the external file is not being rendered. In my html.tpl.php file I have: <?php print $styles; ?> In my template.php. file ...
0
votes
1answer
31 views

How do I translate hard coded words in twig file

Is there a way to translate hard coded words in twig when selecting a language from the language dropdown? I have used the |t ({{ myword|t }}) function but it doesn't seem to be work when selecting ...