Home > Drupal 7 > Drupal Theme_hook_suggestions

Drupal Theme_hook_suggestions

Contents

Notice: Trying to get property of non-object in templatename_process_page() (regel 100 van /srv/www/htdocs/site/themes/touch/template.php). Seems similar. The underscore typo was just in the post. 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. his comment is here

asked 4 years ago viewed 3922 times active 4 years ago Upcoming Events 2016 Community Moderator Election ends in 9 days Related 0Drupal 7 function menu_tree_page_data not working correctly?0Drupal Front Page Suggestions are discovered on the fly. Seeing as it is documented or documentable, we can call this a feature request I guess. See region.tpl.php in the Drupal API documentation for more information. http://drupal.stackexchange.com/questions/1501/page-template-suggestions-are-not-working

Drupal Theme_hook_suggestions

To solve this problem the template.php file needs to contain the following lines: /** * Override or insert variables into the node template. */ function bartik_preprocess_node(&$variables) { if ($variables['view_mode'] == 'full' Since this operation is essentially point & click in other cms' like joomla I'm beginning to think its a bug in D7. Overriding themable output Overriding themable output Beginners guide to overriding themable output Introduction to PHP for theming About overriding themable output Setting up variables for use in a template (preprocess and

  • Tim Log in or register to post comments Add child issue, clone issue News itemsDrupal news Planet Drupal Association news Social media directory Security announcements Jobs Our communityCommunity Getting involved Services,
  • Any ideas?
  • The reason that I'm not just using page.tpl.php is because they're laid out differently than every other basic page on the site. –Brandon Dec 7 '12 at 17:26 So
  • An example of a region-specific template would be "block--sidebar_first.tpl.php".
  • If you did that, then the only reason the suggested template file is not being used is because the file is not correctly named: in the case the page shows a
  • 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]

I've defined a custom entity with custom templating equatable to node, so hook_theme, preprocessor and template etc. View ouch - I see. sorry... Drupal 7 Page Template For Content Type If you need to extend it further, add a preprocessor for the theming hook into your template.php file.

Then restarted the webserver, cleared the cache via admin/settings/performance page, and refreshed the page view of the node. Theme Debug Drupal 7 Log in or register to post comments Comment #12 andyhu CreditAttribution: andyhu commented September 16, 2012 at 3:47am #10 works for me, thanks for sharing Log in or register to post if (!empty($user->roles)) { foreach ($user->roles as $role) { $filter = '![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s'; $string_clean = preg_replace($filter, '-', drupal_strtolower($role)); $variables['template_files'][] = 'page-' . $string_clean; } } } Theming a page by arbitrary content types https://www.drupal.org/docs/7/theming/overriding-themable-output/working-with-template-suggestions The next pitfall is that all hyphens will get replaced by underlines.

A few notes: When adding to 'template_files', add to the array. Drupal Theme Debug Any variation of this I find in these forums isn't working either. For example: node.tpl.php <-Does nothingnode--product.tpl.php <- Does nothing BTW...did you get this working in template? // $variables['theme_hook_suggestions'][] = 'page__'. Is RandomGraph really random?

Theme Debug Drupal 7

Interestingly some content types seem to be suggested automatically, while others do not. https://www.drupal.org/docs/7/theming/template-theme-hook-suggestions See poll-vote.tpl.php in the Drupal API documentation for more information. Drupal Theme_hook_suggestions 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?"). Drupal Theme Hook Suggestions Not Working Would it be simpler to use the method described here?

Browse other questions tagged theming or ask your own question. this content Thanks C drupal drupal-7 drupal-views share|improve this question edited May 2 '12 at 19:37 asked May 2 '12 at 19:30 Cybercampbell 87343063 add a comment| 1 Answer 1 active oldest votes This suggestion is used by default and the template file is located at "modules/poll/poll-results--block.tpl.php". it was helpful for me mmz81 commented September 14, 2011 at 1:34pm thanks! Drupal 8 Theme Suggestions

Did Trump call Belgium a village in Europe? Two important things. 1.) The node.tpl.php file is not needed in the sub-theme directory 2.) The name of the node type specific theme override file has the following format node--[node type].tpl.php Encasing a star in a perfect insulator Why were pre-election polls and forecast models so wrong about Donald Trump? weblink Log in or register to post comments Comment #38 Alexander Allen CreditAttribution: Alexander Allen commented September 26, 2013 at 12:20am Status: Active » Fixed Paul B, According to comments #20 and

html.tpl.php base template: html.tpl.php The following are some examples of how you may override the base template: html--internalviewpath.tpl.php html--node--id.tpl.php See html.tpl.php in the Drupal API documentation for more information. Drupal Node Template more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Secondly: In skeletontheme 7.x-1.2 there seemes to be a copy of the bartik node.tpl.php so probably there is no bug in the file.

For instance if your module is called 'MyModule', the most general theme hook suggestion for this module would be "block--MyModule.tpl.php." See block.tpl.php in the Drupal API documentation for more information.

Suggestions only work when it is placed in the same directory as the base template. Should I trust a website which breaks when I use a complex password? You could change the code for your theme, and let it use the page--node-type.tpl.php template, if it doesn't find a template like page--book.tpl.php. Drupal 8 Theme Hook Suggestions Useful for presenting a friendlier page without error messages.

For example, "example.com/search/node/Search+Term" would result in "search-results--node.tpl.php" being used. In the template.php file, I have the following code: function mytheme_preprocess_page(&$variables) { if(isset($variables['node'])){ if($variables['node']->type === 'sports'){ $variables['theme_hook_suggestions'][] = 'page__node__sports'; } } } And I have a page_node_sports.tpl.php file in my theme's News itemsDrupal news Planet Drupal Association news Social media directory Security announcements Jobs Our communityCommunity Getting involved Services, Training & Hosting Groups & Meetups DrupalCon Code of conduct DocumentationDocumentation Drupal 8 check over here Which is odd considering that my themes normal node template was being used just the day before and nothing about the site changed during the time. /profiles/commons/themes/commons/commons_origins/templates/panels/node--panel--fallback.tpl.php Log in or register

That way theme discovery automatically recognises them as based on 'entity'. Log in or register to post comments Comment #14 blitux CreditAttribution: blitux commented November 27, 2009 at 9:12am Has been any advance on this issue? asked 5 years ago viewed 15177 times active 2 years ago Linked 1 How should I name the node template files for my theme? 1 Template suggestion being ignored 1 Using they may not have tested for this functionality and so didn't notice etc.

Currently that does nothing without the patch above, or, injecting your own template suggestion via template.php. Cache issue When working with theme hook suggestion, there is a possibility that Drupal use its cache rather than the new templates as suggested. How? We do this because the hyphens used for delimiters // in hook suggestions cannot be used in the function names of the // associated preprocess functions.

petersmeekens commented August 28, 2011 at 9:34am Great indeed! Thanks! In my subtheme I created 2 custom .tpl.php files, but both of them not out of node.tpl.php. (First one out of page.tpl.php and second one out of a views style. Log in or register to post comments Comment #26 February 5, 2013 at 5:10pm Status: Fixed » Closed (fixed) Automatically closed -- issue fixed for 2 weeks with no activity.

The prefix of "drop" should be the name of your theme. 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 implode('|', $types) . ')(\.|__)'; The above code is where the pattern is set, and through hook_theme the "base hook" is set to "entity" for any entity api defined entities, my current I don't think this will land in d7 anytime soon, so I'd be fine adding a interim fix.

Log in or register to post comments Comment #8 krueschi CreditAttribution: krueschi commented January 20, 2014 at 2:11pm The code lines in #5 and #6 will probably not work: your function Has a movie ever referred to a later movie? Use two hyphens to separate the hook name from the rest of the suggestion. Also see the change notice for more infos on the impact of this change.

Log in or register to post comments I'm having similar issues in bobtimms commented January 25, 2011 at 1:29am I'm having similar issues in that I need to create a custom