Theme templates are part of Drupal's theming system and allow for the customization of Drupal sites.

learn more… | top users | synonyms (3)

0
votes
1answer
23 views

How do I print the output of a field as a link on node.tpl.php?

How do I print the output of a field as a link on node.tpl.php? I'm able to print the raw output of a field using this: <?php $display = array('label' => 'hidden'); $view = ...
0
votes
0answers
18 views

How do I render the primary menu's markup?

I have {{ page.primary_menu }} in page--front.html.twig and I have the following in the .info.yml file of the theme. regions: header: Header primary_menu: 'Primary menu' content: Content ...
0
votes
1answer
22 views

Creating a (candidate) template file

Drupal: 7.x Theme: Bartik I am using the newly created Commune module to display wall posts on a user's profile page (panels.) Each post has a form below it for comments. The comment form is created ...
1
vote
2answers
72 views

How to animate set of titles of a View using JQuery

There is a View of latest news title linked to the node page and I need to display them like this Effect. I've trying to do it by creating a new template file for my views named: ...
0
votes
0answers
10 views

views_embed_view show a related view within a node template

Drupal version: 7.x Goal: Show related questions via embedded view. Situation: A bunch of nodes are of a "faqs" content type each with a taxonomy term. There are three view blocks that pull nodes ...
0
votes
0answers
5 views

Insert code in views-view-unformatted.html.twig for specific rows in views

Twig template - views-view-unformatted.html.twig: #} {% if title %} <h3>{{ title }}</h3> {% endif %} {% for row in rows %} {% set row_classes = [ default_row_class ? 'views-row', ] %} ...
1
vote
1answer
23 views

How to render a views title in .tpl file?

I embed a view in a .tpl file but it doesn't show the title. It only shows the content. How to render the title of the view? I'm using the code below: <?php print views_embed_view('dummy'); ...
0
votes
3answers
60 views

How to add an 'if' statement for a content type in a custom views-view.tpl.php?

Is it possible to add an 'if' statement for a content type in a custom views-view.tpl.php? This is just so I can add text to show if the post in the view is either an 'episode' or an 'announcement'. ...
0
votes
2answers
25 views

How to conditionally load javascript file on view page

I'm trying to load some theme javascript only to one view(multiple displays). I've tried to use the views preprocessor funciton, but maybe I'm doing it wrong: function ...
0
votes
1answer
19 views

How can I seperately display a view's exposed filter and its content in page.tpl?

Using <?php dpm($node) ?> I found the exposed filter, $...->view->exposed_widgets, however I'm not sure how to display it. I tried <?php echo $node->view->exposed_widgets; ?> ...
0
votes
1answer
9 views

Block value in a view row design template

I have a block value which I need to access in a views row design template. I need to check the value of the block content in this template. Does anyone know how?
0
votes
0answers
11 views

Ability to pass data “up” from template_preprocess[whatever] to template_preprocess_page?

I'm using template_preprocess_panels_pane and I have custom css that need to be generated and inserted in the header depending upon data in the panels pane. I can do drupal_add_css from ...
0
votes
0answers
21 views

Unable to get bootstrap working for IE8 on custom theme

I'm attempting to get bootstrap to work for a custom theme. It works fine in everything except for IE8. The page in question has the following content <div class="container"> <div ...
0
votes
2answers
26 views

How to edit image field output from template

My goal is to edit the output of a specific field in a view. There is an image field, and I would like to specify how it is output. So that instead of <img typeof="foaf:Image" ...
0
votes
2answers
27 views

Display Image logo along with site slogan and site name

I am using Impact theme for my site. It either displays text logo(site name, site slogan) or image logo. I want both image logo and text logo for my site. Any helps are welcomed
0
votes
3answers
55 views

Display a block on front page only

How do I only show a block on the front page. I have on only listed pages under block settings and it won't disappear on the second page. I've also added $is_front drupal_is_front_page around the ...
0
votes
0answers
19 views

Call block in template file

Is there some simple code I can add to my page.tpl.php to call a block directly from the template file? I cannot add modules to this site Users need to be able to edit the contents of the block ...
0
votes
2answers
14 views

Node Teaser template in custom module

I have used given below code for node--[content_type].tpl.php (default) template file function MYMODULE_theme($existing, $type, $theme, $path) { return array( 'node__NODETYPE' => array( ...
0
votes
3answers
31 views

Is ist possible to get the page variables in node templates?

I set a variable by implementing the hook hook_preprocess_page. The variable is available in $variables['my_custom_var'] within the page.tpl.php. Is it possible to get access to this variable in ...
0
votes
0answers
10 views

Q: How to control theme colors for Drupal 7 mass contact email

I'm using the Corporate Clean theme as the basis for my site. I've customized some theme colors to my liking. I have installed the Mass Contacts module to send bulk email. I've specified in the ...
0
votes
1answer
18 views

How can I programatically get the cart's dollar sum of drupal commerce?

For future users <?php echo '$' . number_format(( $total['amount'] /100),2); ?> is how. Following this guide ...
0
votes
1answer
23 views

override the default url of a page

I want to override the default URL of taxonomy pages so that, if I have pizza as child of food the URL become like this: taxonomy/term/food taxonomy/term/food/pizza or taxonomy/term/drinking ...
0
votes
1answer
23 views

“Undefined index” error for field which is defined

I'm getting a strange error on a Views page, even though the page works. I get ten instances of this error: Notice: Undefined index: field_video in include() (line 28 of ...
2
votes
1answer
87 views

Use a Custom Field in page.tpl.php

I have a custom field called site_category that I am using in a few different content types. The field site_category is an entity reference to a content type which has only one field defined: Title. ...
0
votes
0answers
21 views

Is there any way to get the view object in views-view-grid-page.tpl.php

Here is the views-view-grid-page.tpl.php code: <?php /** * @file * Default simple view template to display a rows in a grid. * * - $rows contains a nested array of rows. Each row contains an ...
0
votes
0answers
22 views

View theme override in drupal 8

I am new to drupal 8 and i need to override a views template. So, for that I have enabled theme debug in services.yml to view the twig template suggestion name. This is my view theme debug. <!-- ...
0
votes
0answers
29 views

Preprocess is not working

I have a custom hook in which there is a text field, is supposed to collect a url, on submitting the form it will check if there are any tpl files in that location. I have a content type called ...
0
votes
2answers
27 views

Custom node Template for script tags

I wanted to add script code to implement "LiveChat" functionality on just three pages of our website. So, I wanted to add one script code given by our LiveChat agency into three webpages of our ...
0
votes
1answer
16 views

Make changes to <head> for homepage only

I need to insert hreflang tags inbetween the head tags, but I only need these on the homepage. At the moment I'm inserting the hreflang tags into the head via the html.tpl.php template, but this puts ...
0
votes
0answers
3 views

Modify the top-level book page

I'm new to the Book Module and pretty excited, but I'm a little confused about the pages. I'd like to customize the top-level page of a book with either a view or a custom template. I looked that ...
0
votes
1answer
11 views

How can I remove the descriptions from the registration page programatically?

Using the custom module mentioned here https://www.drupal.org/node/754542#comment-2775706 I was able to remove the descriptions from the user login page. function ...
0
votes
1answer
12 views

hook_theme_registry_alter caches

this function caches the output, so it doesnt work if I want to change dynamically between two template files. For example user-profile.tpl.php and user-profile-project.tpl.php Code: function ...
0
votes
1answer
40 views

page.tpl.php base on a field criteria in views

I'm working on creating different themes in different pages of a site base on several conditions. first, I want to create a page.tpl.php for all view pages in my site. second, I want to have tiny ...
0
votes
1answer
11 views

Change template of Drag & Drop module on node add form

I am using Drag & Drop Upload module for multiple images uploading. But the template I see on node add form (FRONTEND) is this : And I want to change it to this : I don't know where can I ...
0
votes
1answer
15 views

How can I remove javascript from everywhere but the front page?

I tried using this in template.php function MYTHEME_js_alter(&$javascript) { if ($!is_front) { unset($javascript['path/to/script.js']); } } but it doesn't work. Performance wise, would ...
0
votes
1answer
19 views

Bootstrap theme overrides “theme_list_item” function and removes div's “item-list” class

How can I stop Bootstrap theme from overriding the them_item_list and replacing the div's class from item-list to panel-body? I have the following form and it does not render the items $stages = ...
0
votes
3answers
35 views

Hide the page titles of some content types

I found following code on this website http://codekarate.com/content/hiding-page-titles-specific-node-types-drupal-6 to hide the page titles of some content types. Can some one help me rewrite this ...
0
votes
1answer
37 views

How can I serve different view blocks based on media queries?

I have 4 view blocks that I want to show up as carousels on mobile. I'd like to be able to clone them, turn the clones into carousels with this module https://www.drupal.org/project/slick, then serve ...
0
votes
3answers
35 views

How do I name a theme file for view?

I am trying to theme a block from my view. I have a view called slides and it is creating a block. I have a template file I want this block to use. I have looked at the documentation for themes and ...
0
votes
0answers
52 views

How to theme a paragraph bundle with a template file

I am using the paragraphs module version 7.x-1.0-beta6 I have a bundle with the machine name: text_buttons In the paragraphs module there are two theme suggestions: paragraphs-items.tpl.php ...
0
votes
1answer
38 views

Add class to image in view

Is there a way to add a specific class to the img tag in a view? I'd prefer to use a template to perform it. I can see how I can change what classes the image is wrapped in, but I don't see a way to ...
0
votes
3answers
46 views

Where do twig files find variables?

for example for the file node.html.twig has a giant comment saying * Available variables: * - node: Full node entity. * - id: The node ID. * - bundle: The type of the node, for example, "page" ...
0
votes
1answer
23 views

How do you programmatically hide a field based on another field on a custom content type?

I have built a custom content type that has a boolean field called 'Hide images'. There is also an images field that displays all images at the bottom of the node. I'd like to setup a way so that ...
0
votes
0answers
23 views

How can I alter variables sent to a paragraph bundle template within a module?

I need to preprocess the field values of a paragraph bundle to "send" additional variables to the template (paragraphs-item--xxxx--full.tpl.php). I want to avoid putting too much php logic into the ...
0
votes
2answers
20 views

Body classes still showing 'page-node-#' instead of title or menu word

I'm trying to get either the title of a page or the menu entry to be listed as a class in the body tag. I came across a posting here utilizing this code: function ...
1
vote
1answer
43 views

How to upgrade my Zen sub-theme so that navigation and most of the blocks are no longer missing?

I have been looking quite a bit for a "step by step" for what people did to upgrade their Zen Sub-themes from its 6.x version to the 7.x-5.x version. I did not make the sub theme I'm working with and ...
0
votes
3answers
61 views

How do I add custom script on the specific page?

I wanted to add custom javascript on certain pages, in this case it is /DONATE page (example.com/DONATE and it's a node). I have written this in my html.tpl.php but this doesn't work. <?php ...
0
votes
2answers
27 views

print full url template

I'm building a multi language site but I'm facing a problem with an url. In my template i have the following print rule for an url <?php print $base_url.'/#project';?> The base url only prints ...
1
vote
1answer
30 views

How do you refer to the field in views-view--field-fieldname.tpl.php?

I'm using the views-view-field--field-fieldname.tpl.php to rewrite the output of a specific field in a view. However in this template I'm having trouble referring to the actual field. I can produce ...
0
votes
0answers
25 views

Print value from Views field & HTML into Colorbox Image caption?

I have created a view for an image gallery with the images using the colorbox field formatter so that they open up in a colorbox window when clicked. I would also like to display the values from the ...