Questions tagged [drupal-templates]

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

The template files are files used in Drupal to render a page, or part of a page; for example, Drupal uses a template file to render a node, and third-party modules can use a template file for their own pages, or for the theme functions they implement.

85 questions
8
votes
3 answers

How does hook_theme() work?

I am having a hard time understanding what hook_theme() does. My understanding is that it has something to do with making it possible to override templates. I was looking at: $theme_hooks = array( 'poll_vote' => array( 'template' =>…
Chris Muench
  • 15,874
  • 66
  • 193
  • 332
6
votes
1 answer

Drupal Token Replacement in Template File

Can I use token replacements in Drupal template files? I'm trying this: $author_uid = "[node:author:uid]"; $nid = "[node:nid]"; But it's not working. How can i properly use token replacements in my node.tpl.php template?
hanleyhansen
  • 5,594
  • 6
  • 32
  • 70
6
votes
1 answer

Drupal 7 preprocess_views not working

I have the following code in my Drupal 7 template.php file: function mytheme_preprocess_views_view__videos__videos(&$vars) { drupal_add_css(drupal_get_path('theme', 'mytheme') . "/css/qwembed-jquery-1.0.css"); …
Cybercampbell
  • 2,358
  • 10
  • 44
  • 75
5
votes
2 answers

Drupal 7 views_embed_view and templates

In Drupal 7 created a block view (called *super_gallery*) of grid format added a template specialization views-view-grid--super-gallery--block.tpl.php cleared theme registry cleared all caches Using preview in view editor I can see output modified…
Alessandro Pezzato
  • 7,820
  • 5
  • 39
  • 59
5
votes
2 answers

Using preprocess hook on specific node type in Drupal 8

I've had success using preprocess page hooks such as: function mytheme_preprocess_page__node_front(&$variables) { ... } and function mytheme_preprocess_page__node_12(&$variables) { ... } which correlate with custom templates named…
ConorBaumgart
  • 361
  • 1
  • 2
  • 13
5
votes
5 answers

Adding a JavaScript file

I'm trying to insert reference to the Javascript file in the header by using drupal_add_js(). I placed this line inside the template preprocess function in template.php. The result that the code is not working at all: There is no script link in…
Andrew
  • 985
  • 7
  • 21
  • 39
3
votes
1 answer

Using Drupal Views VS templating

I have recently started working with Drupal on the side and have had to tackle the limitations I come up against in the Views API. More than not I find it faster and more powerful to code it myself. It is hard to create custom views that have a…
JeroenEijkhof
  • 2,122
  • 2
  • 24
  • 37
3
votes
5 answers

Drupal 7: Template for user registration page?

How would I make a template for the user registration page? I want to theme the entire page, not just the form. I've tried page--user-register.tpl.php but that does not work.
Dustin
  • 3,772
  • 10
  • 48
  • 84
2
votes
1 answer

drupal7 change format of comment's $created

I have been trying for some time now to reformat the date that appears below the avatar when a comment is made to a blog post. I have found no way of doing it through any settings, so I have moved over to the template files. Changing the date format…
2
votes
3 answers

drupal_set_message() not working in node.tpl.php template on Drupal 7

My problem is with in node.tpl.php In node.tpl.php, I have also done to find out if the theme template is set correctly. The answer is yes. I also have…
logii
  • 320
  • 1
  • 3
  • 15
2
votes
3 answers

Drupal 7 comment.tpl.php overwrite for specific node type is not working

I've created a comment--track.tpl.php file in order to theme the comments of my "track" type node but I can't get Drupal to use it. It keeps using my themename/comment.tpl.php file. I made sure to clear cache, I also set the Devel module to rebuilt…
vxcriss
  • 21
  • 1
  • 4
2
votes
3 answers

Drupal 8 - Core search module, change markup

How do i change this markup from my .theme file? Line 119 in \core\modules\search\src\Controller\SearchController.php if (count($results)) { $build['search_results_title'] = array( '#markup' => '

' . $this->t('Search results') .…

Patrick
  • 92
  • 12
2
votes
1 answer

I cannot replace a JavaScript file

I want to remove a JavaScript file from my Drupal website, and add a custom one. This is the code I'm using in my template.php file, but it doesn't work (the old js file is still loaded). (I've cleared the cache) function zen_preprocess_page(&$vars,…
aneuryzm
  • 55,858
  • 96
  • 259
  • 471
1
vote
2 answers

Show all regions when returning content from menu callback url

made a simple thankyou page (e.g. /product/3/thankyou) based on a menu callback in a custom module. the content shows up fine in the normal page layout but i want the regions and blocks to show up and they don't. suggestions? // menu…
aterchin
  • 39
  • 4
1
vote
2 answers

Changing Drupal module template doesn't take effect

Okay, this could be a stupid question but I'm kind of new to this Drupal-stuff so I have to ask it anyway :) I'm trying to implement the FBSS-module (FaceBook Style Status). It all works just fine. I was even able to change some colors and stuff in…
digi
  • 2,529
  • 1
  • 11
  • 16
1
2 3 4 5 6