Home > Drupal 7 > Drupal 7 Theme_hook_suggestions Not Working

Drupal 7 Theme_hook_suggestions Not Working


No preprocess function is necessary. Theming Drupal 7 Overview of theme files Writing theme .info files Default .info values Assigning content to regions Checking to see if a region is occupied Theme settings Global Settings Integrating So what about the patch in #1? Also remember to include "field-" in custom field names, e.g: field--field-phone.tpl.php. check over here

right now i had to declare the template in a custom module using hook_theme() whereas if Drupal was working correctly it would be automatically included which it is not. But still not works -_- Any idea? I actually liked the previous way, prefixing templates with "entity", it's easier to recognise them. I've tried all of the possible derivatives of page--lab.tpl.php, page--node--lab.php, page--lab--%.tpl.php etc without success. http://drupal.stackexchange.com/questions/52544/theme-hook-suggestions-is-ignoring-my-suggestions

Drupal Theme Hook Suggestions Not Working

Thanks! Do not reset it since the variables are passed by reference. Log in or register to post comments News itemsDrupal news Planet Drupal Association news Social media directory Security announcements Jobs Our communityCommunity Getting involved Services, Training & Hosting Groups & Meetups

The idea is simple but it is a powerful feature, providing another layer of customization. My site doesn't even break when I do it. Then I flushed the cache & held my breath. Drupal 7 Page Template For Content Type vitok-dupe commented January 28, 2011 at 12:09am Yes it's!

What I've done is added my suggestion to the theme_hook_suggestions array. Theme Debug Drupal 7 I just want an arbitrary template file. –Brandon Dec 7 '12 at 16:33 What are 'newbies' then, in the Drupal sense? –Alex Gill Dec 7 '12 at 16:37 How many seconds are a meter in the 4th dimension? this content After renaming my page.tpl.php to page--front.tpl.php I was able to see my changes but html.tpl.php still shows in devel_themer.

Any idea what's going wrong? Drupal Page Template For Content Type Looking for a solution on the web, i understand that i must edit the template.php file in y theme and add some line of code to the %themename%_preprocess_node() or %themename%_preprocess_page() function. poll-bar--[block].tpl.php base template: poll-bar.tpl.php Same as poll-vote--[block].tpl.php but for generating individual bars. The key of 'theme_hook_suggestion' accepts a single suggestion and it takes precedence.

  1. And, honestly, calling the template functions ourselves might be overkill once that patch goes in.
  2. Some pages might be temporarily missing, and some guides might appear empty.
  3. if ($suggestions = theme_get_suggestions(arg(), 'html')) { $variables['theme_hook_suggestions'] = $suggestions; } } Nothing happening though when i implement a custom html--mycontenttype.tpl.php thanks Lee Log in or register to post comments News itemsDrupal
  4. Teenage daughter refusing to go to school more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback
  5. All layers from core, modules, theme engines and themes can provide the suggestions.
  6. function drop_preprocess_page(&$variables) { global $user; if (!empty($user->roles)) { foreach ($user->roles as $role) { $filter = '![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s'; $string_clean = preg_replace($filter, '-', drupal_strtolower($role)); // looks for page--[role].tpl.php in your theme directory // ex:
  7. Suggestions work only when it is placed in the same directory as the base template.
  8. But the template suggestion just isn't working.

Theme Debug Drupal 7

Thanks again. https://www.drupal.org/node/1161748 See maintenance-page.tpl.php in the Drupal API documentation for more information. Drupal Theme Hook Suggestions Not Working forums--[[container|topic]--forumID].tpl.php base template: forums.tpl.php Theme hook suggestions are made based on these factors, listed from the most specific template to the least. Drupal 8 Theme Hook Suggestions This is down to this related issue #2225491: entity_theme not calling custom templates. /** * Implements hook_theme(). */ function entity_theme() { // Build a pattern in the form of "(type1|type2|...)(\.|__)" such

thank you for helping me. http://sevevb.com/drupal-7/drupal-7-hook-install-not-working.html D7 caches all implemented hooks so the new one won't be active until the cache is cleared. Why Would the President-elect have a Transition Visit before December 19? US Election results 2016: What went wrong with prediction models? Drupal Node Template

However, adding that functionality just for one single module's templates would be really confusing, especially for beginners ("Why does this work for my entity preprocess hooks but not for anything else?"). There are two ways to add these suggestions. After the list of components is iterated through, if the page is the front page (as set through "Administration > Configuration > System > Site information."), then "page__front" is added to this content Log in or register to post comments Comment #23 fago CreditAttribution: fago commented January 22, 2013 at 4:23pm Status: Needs work ยป Needs review FileSize d7_entity_template_fix.patch860 bytes PASSED: [[SimpleTest]]: [MySQL] 374

Additionally, I guess we should fix template suggestions to do not include the bundle if the entity type does not make use of bundles.Files: CommentFileSizeAuthor #23 d7_entity_template_fix.patch860 bytesfago PASSED: [[SimpleTest]]: [MySQL] Drupal 8 Theme Suggestions Drupal will use the most specific template it finds: taxonomy-term--tid.tpl.php taxonomy-term--vocabulary-machine-name.tpl.php taxonomy-term.tpl.php Note that underscores in a vocabulary's machine name are replaced by hyphens. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed

If you're doing anything with hook_preprocess_page() you are affecting the 'page'.

Notice: Undefined index: node in templatename_process_page() (regel 100 van /srv/www/htdocs/site/themes/touch/template.php). For example, a comment made on an article-type node would be "comment--node-article.tpl.php". I'm not seeing the problem I was having #20 after applying the patch in #23. Drupal 7 Hook Theme Log in or register to post comments Comment #9 gease CreditAttribution: gease commented April 27, 2012 at 2:28pm Still, the patch #1 doesn't work for template suggestions like entity_name.tpl.php.

Modules can extend search types adding more suggestions of their type. The key of 'theme_hook_suggestions' (plural) can accept an array of suggestions. Where is the problem ? have a peek at these guys It's ignoring what I'm adding.

Adding to the array should be done with a general condition first, progressively getting more specific so it cascades based on specificity. You shouldn't even have to write a preprocess function. So, EntityAPI provides entity_type--entity-bundle--view-mode suggestion, but creating that tpl file in your theme does absolutely nothing (right now). For example, just creating an arbitrary template file (in this case 'newbies') instead of some system defined one like 'page--type--system--node......' etc..

Log in or register to post comments I've modified it to use a robmalon commented March 4, 2011 at 8:20pm I've modified it to use a path. Log in or register to post comments Change records for this issue Discover {$entity_type}.tpl.php templates if no custom template is defined Add child issue, clone issue News itemsDrupal news Planet Drupal Drupal will use the most specific template it finds: block--module--delta.tpl.php block--module.tpl.php block--region.tpl.php "module" being the name of the module and "delta", the internal id assigned to the block by the module.