The preprocess functions are functions that are executed directly before a theme function is invoked.

learn more… | top users | synonyms

0
votes
0answers
21 views

White Screen of Death after tweaking template file and adding a views template file

Experimenting with Drupal I learned fairly quickly that ANY syntactical/semantic error invites the dreaded White Screen of Death, so I've become somewhat accustomed to debugging the minor errors I ...
0
votes
1answer
21 views

How do I add to $page_top in html.tpl.php?

I wanted to add a piece of HTML at the top of all pages, right after <body>. In the #drupal IRC channel I got the recommendation to override html.tpl.php in the theme. That works fine. But isn't ...
0
votes
0answers
15 views

hook_preprocess_views_view_fields not being invoked

This is a problem that is very hard to debug, so any help on how can I bite it - will be appriciated. I have custom theme based on tao that I named "clear" . I put it in sites/default/themes/clear . ...
0
votes
2answers
22 views

Render Block in preprocess page

I try to copy an existing Block and print it in the left sidebar for some content types. That works, but what i`m missing is that i must activate the sidebar first and in the body classes the ...
0
votes
1answer
27 views

How to hide a user profile based on custom field?

I need to allow users to turn off the public display of their profile if they wish too. I created a Boolean field to store whether the user wanted the profile shown or hidden. According to this ...
0
votes
2answers
52 views

presidency of drupal template file

I am new to drupal themeing, I have tried to find the presidency of template files(.tpl.php).. So my question is for a particular scenario if I have html.tpl.php, page.tpl.php, block.tpl.php, ...
0
votes
0answers
16 views

Main Menu not rendering?

Recently we merged our test server with our production server. When this happened, we installed a new theme on production that we had been using on dev. All of a sudden our production site's ...
0
votes
0answers
24 views

Move $title variable to region--content.tpl.php

I'm having a bit of trouble sorting something out. I'm trying to move the $title variable to region--content.tpl.php. I think a preprocess function - some variation of template_preprocess_region is ...
1
vote
3answers
47 views

Wrap a single html tag around each block that's generated from a single view

I'm sure this isn't difficult, but I can't seem to figure it out. I have about 10 block displays generated from one view that needs a single html wrap (Setting the css property in the view itself is ...
0
votes
0answers
21 views

Set Taxonomy term option value to a field value

I want to change to value of the taxonomy term options (in a reference field) from the ID to the value of a field in the vocabulary. Is there a way to do this, preprocessing the term field or ...
0
votes
0answers
20 views

Page specific js despite loading pages with ajax

I am currently building a small site which loads menus and content using ajax (which works), however I can't find a way to add additional scripts to specific pages. Usually I would add the js.script ...
0
votes
3answers
53 views

How to update field values of a content type's nodes when when viewing a particular content type page

I'd essentially like to alter the values of a specific custom field of a few of nodes before they're displayed in a view on the 'page' of a specific content type. The content type is that will be ...
0
votes
0answers
18 views

Add classes to Field collection Items

I want to add classes to the Field collection items (multiple value field), for a stored value earlier generated by HOOK_preprocess_node. What is path / array to get to the classes_array for the ...
0
votes
1answer
27 views

Using theme_preprocess_node i'm trying to add a class to all images on the page

My code below is not working and i'm not sure why. I've tried a few variants. according to the KPR variables output, the image I'm trying to access is here. $variables['field_about_image'][0] i ...
0
votes
0answers
28 views

Google Authorship markup in Drupal 6

I am trying to implement Google Authorship code which is basically a tag like: <link rel="author" href="https://plus.google.com/26716726176271627617/" /> on the main blog page of a Drupal 6 ...
0
votes
1answer
28 views

Question about template_preprocess functions

i noticed there exists a template_preprocess_field function on the Drupal website, but i added in my template.php files just this... function mytheme_preprocess_field(&$variables, $hook) { ...
1
vote
1answer
32 views

display view mode on node based on field setting or taxonomy term of user profile

I'm using Display Suite which is awesome and an easier solution if you're not a coder. Now that I have created several view modes I'd like to set a particular view mode that is based on a field ...
0
votes
1answer
24 views

Add css file when editing specific content type

I would like to add a css file when editing content of the content type invoice. The link is something like this: node/121/edit . I've tried it with it with preprocess_node like this: function ...
0
votes
3answers
49 views

How to print preprocess_html variables in page.tpl

I have variable in template.php to use in different files like page.tpl, but written this in preprocess_html function as below, how can i print this in page.tpl and html.tpl file. ...
0
votes
1answer
31 views

Custom status message on a Views page

I have different urls : domain.com/blog : a list of articles made with Views module domain.com/blog/article-title : article alias domain.com/newsletter/confirm/add/xyz/ok : confirmation link sent to ...
0
votes
0answers
29 views

How to add css using the Preprocess_image function

I'm trying to preprocess my image style like this example <img class="media-object img-rounded img-responsive" src="http://placehold.it/350x250"> My preprocess_image function is not adding ...
0
votes
1answer
37 views

Why is my theme's block preprocess function not reordering elements?

I'm trying to do something that seems fairly basic, but I'm having loads of trouble. The drupal search_form block outputs an input field and a submit button, in that order. I'd like to swap the ...
0
votes
4answers
29 views

what variable can i use to identify a specific pages

i need to load a diff stylesheet depending upon which page the user is on. when using: themename_preprocess_page(){kpr(&$variables;)} i thought i'd see a pageId or pageTitle in which i ...
0
votes
2answers
56 views

How to change page CSS based on parent menu item?

I'm building a fairly simple site, and I need to alter a background image based on what section the user is in. The main menu only has 2 levels. I'm unsure where I should hook into in order to be able ...
0
votes
1answer
34 views

Can you preprocess a specific region in template.php?

In your template.php file, I know you can use theme_preprocess_region and check what "region" you are in, and accomplish what I am attempting like that...but I was wondering if you can do something ...
0
votes
1answer
78 views

dd a class=“” to anchor on the “read more” links of a node

How I can add a class="" to anchor on the "read more" links of a node. Im use a bootstrap theme and i need add de btn-default class to anchors, thanks <ul class="links list-inline"> <li ...
0
votes
0answers
41 views

Undefined variable from variable in template.php

In template.php I have this function. function my_theme_process_page(&$variables) { $menu_tree = menu_tree_all_data('main-menu'); $variables['main_menu'] = menu_tree_output($menu_tree); ...
0
votes
2answers
30 views

Applying image style to authors pictures in comments without preprocess function

Is there anyway I could apply an image style to the user picture in comments without using a preprocess function (YOURTHEME_preprocess_user_picture?) The reason I ask this is because the preprocess ...
0
votes
0answers
25 views

Using original picture after preprocess function

I have a preprocess function (function MYTHEME_preprocess_user_picture()) that scales and crops user pictures throughout the site and they become the default pictures. How can I still have access to ...
0
votes
2answers
50 views

Fatal error: Cannot redeclare MYTHEME_preprocess_user_picture()

If I add the following: function MYTHEME_preprocess_user_picture(&$variables) { $variables['user_picture'] = theme('image_style', array('style_name' => ...
0
votes
1answer
35 views

Need to hide a field for the node author

For a particular content type education i need a field to be hidden for the node author. It works in the template file but not with preprocess. This is my code function ...
0
votes
2answers
64 views

jQuery problem click function [closed]

I'm having trouble doing simple stuff in jQuery. What I wanted was to call a function when something was typed in an input field. Now I'm just trying this: when you click anywhere on the page to ...
-1
votes
2answers
24 views

How can I catch the current node object and make changes into it before it is rendered?

I have a content type with multiple fields. On the node display page I want to do some modification on this node (like. changing label text etc.) and I want to do it for display only. Nothing should ...
0
votes
1answer
32 views

Stylesheet for specific page overwritten by standard css

In my subtheme.info I have : stylesheets[all][] = css/style.css And in my template.php I have: function subtheme_preprocess_page(&$vars) { $path = current_path(); if ($path == ...
1
vote
1answer
51 views

Drupal 8: CDN JS — cannot seem to weight it

I'm adding external JS in my Drupal 8 site (//cdn.leafletjs.com/leaflet-0.7.2/leaflet.js) and I cannot seem to weight it using hook_js_alter. I can weight it if I throw it in a themename.libraries.yml ...
1
vote
0answers
59 views

drupal_static_reset causing errors

I have developed a custom template for a node where I wanted to essentially show the node in a blank white page. I created a file called node--results.tpl.php and page--node--results.tpl.php that ...
0
votes
1answer
38 views

How To Change The $tid to $term_name

I've tried to change this code to show the term name instead of the term ID but now no term name or term id show at all Orginal code for term ID function MYTHEME_preprocess_node(&$vars) { if ...
0
votes
1answer
94 views

Drupal 8 Menu Tree issue in my contrib theme possibly because of “Convert menu tree building to a service.”

Previously, in my Drupal 8 contrib theme, I was rendering the full menu tree as: function gratis_preprocess_page(&$vars, $hook) { // Build the main menu links tree. $vars['primary_nav'] = ...
0
votes
1answer
28 views

Add class that surrounds all tables (or any other node,field etc…) using preprocess template?

I have been able to find information on adding classes to tables and other items in my pages, however, I cannot find any information on wrapping the entire table for example in a div through the ...
-1
votes
1answer
113 views

subtheme preprocess functions inheritance

I'm using Drupal 7 with Boostrap Theme. I put the main theme inside sites/all/themes/ And as a recommanded I put sub-theme in sites/my-site.com/themes/ It's working fine but my question is about ...
3
votes
1answer
53 views

How to override jquery update preprocess page

The objective is to exclude certain javascript files from some sections of the website. I exclude javascript and css files in this way in the template.php file of the theme: function ...
2
votes
3answers
124 views

How to wrap first word of page title in span in drupal 7

I want to implement it with theme_preprocess function. Every my attempt fails. function mdrupal_mono_preprocess_page(&$variables) { $variables['title'] = drupal_get_title($variables['node']); ...
0
votes
1answer
35 views

Custom Block - How to get additional variables

I am new to Drupal and slowly getting my head around it. I'm using Pay to Publish module on my site, I've setup a custom block that gets recent posted advert (very simple) now I want to style the ...
0
votes
2answers
42 views

How to conditionally render fields with a different formatter

I have a content type with two fields one called display which is a simple list and the other is an entityreference field. I would like to change how the entity reference field is rendered depending ...
0
votes
0answers
58 views

Panelized content in Preprocess Page

I have been badly stuck with some preprocess issues of a panelized node...I need to change output of certain fields in panes,but in preprocess_page, the %markup is rendered array in the form of ...
0
votes
1answer
102 views

Preprocess Panels or Panelizer content

I am trying to change output of some of the fields used inside my panelizer content, i.e node pages, but hook_preprocess_page( &$vars) is showing the output as rendered #markup and i just cant get ...
0
votes
0answers
14 views

Understanding field slideshows available variables

I am actually trying to write a patch for the field slideshow module. At the moment i am a little bit stuck with some kind of understandment how the following works: In the field_slideshow.tpl.php is ...
0
votes
1answer
65 views

preg_replace() not working on node title in hook_preprocess_page()

Here's code from my module: function mymodule_preprocess_page(&$variables) { // load the node object $node = node_load(arg(1)); $fied = $node->field_building_sell['und'][0]['value']; ...
0
votes
0answers
46 views

index in multi value fields in Drupal

I've created a content type called Event which has a date field (field_date) that accepts multiple values using Date Repeat API of the Calendar module. I also created two different blocks using Views ...
0
votes
0answers
49 views

Variables not passed to view template

Initially I implemented logic to show results summary inside the views template file realia-view-grid--apartments--listing-row-filtered.tpl Since best practices is to implement it in the ...