By firdous.ali86 on
Hi all,
ive created an entity naming 'publisher', I want to use a template file for viewing its data,
could anybody guide me about the template naming convention and appropriate way to do it.
Hi all,
ive created an entity naming 'publisher', I want to use a template file for viewing its data,
could anybody guide me about the template naming convention and appropriate way to do it.
Comments
any thoughts?
any thoughts?
any second thoughts?
any second thoughts?
I've been trying to figure
I've been trying to figure out the same thing. There doesn't appear to be any documentation on theming entities. :-/
What I'm doing now is looking at the commerce module (http://drupal.org/project/commerce). They create their own entities and have some theming in the module. Might give some insight on theming entities.
hmm.. also in the entity.tpl
hmm.. also in the entity.tpl (http://drupal.org/project/entity) there is pretty good documentation about it. But i would have to learn how to use it, simply creating tpl files doesnt work at all
plz share any info you get
Thanks
/**
* @file
* Default theme implementation for entities.
*
* Available variables:
* - $content: An array of comment items. Use render($content) to print them all, or
* print a subset such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
* - $title: The (sanitized) entity label.
* - $url: Direct url of the current entity if specified.
* - $page: Flag for the full page state.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. By default the following classes are available, where
* the parts enclosed by {} are replaced by the appropriate values:
* - entity-{ENTITY_TYPE}
* - {ENTITY_TYPE}-{BUNDLE}
*
* Other variables:
* - $classes_array: Array of html class attribute values. It is flattened
* into a string within the variable $classes.
*
* @see template_preprocess()
* @see template_preprocess_entity()
* @see template_process()
*/
Theming Entities
I'm really disappointed to see there are no responses/help with this. I have been trying to figure out how to theme custom entities for several days now with not much luck. The only slightly promising progress I have made is by creating a template named page--{entity_name}.tpl.php but that over-rides the entire page output rather than just the entity output.
I'm trying to avoid programatically calling theme() in the view callback as this seems less than ideal.
I am really new to Drupal and I am finding the documentation in general to be very confusing and written more for people with prior Drupal knowledge. The doco is also very sparse on actual examples of how to use the various hooks and functions.
in my case
in my case {entity_name}.tpl.php does not override the entity output, m i missing something?
I thought
I thought {entity_name}.tpl.php would be the way to go. That appears to follow the standard naming convention, but we weren't able to get it to work.
iconify got it to work by creating page--{entity_name}.tpl.php. Though that doesn't seem like the proper way to do it.
yeah, even that would help
yeah, even that would help me,
thanks :)
Strange behaviour
I tried doing theme_preprocess_entity to set my own hook suggestion, but the hook was never getting through my entity (commerce_order) until I created an empty page--commerce-order.tpl.php file in the admin theme directory. Strange behaviour.
Possible Solution
Hi,
Whilst it's not directly theming the entity in the way you describe, you might want to try the display suite module. This allows you to create layouts and styling for an entity or node in different contexts and often eliminates the need to create template files in the theme.
Richard
Figured it out
Hey, I have figured out how to do this so you can use {entity_name}.tpl.php - I have posted a more detailed step-by-step explanation on my blog at: http://technify.me/cms/drupal/theming-custom-entities-in-drupal-7/ or on the Drupal Docs page: http://drupal.org/node/1238606