summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfago2013-01-21 16:00:42 (GMT)
committer fago2013-01-21 16:00:57 (GMT)
commit0fb1486b55e1bfae075d5a9948b1de3df8224528 (patch)
tree891e7f8b794bcc3ec2a28d99dc694f257308346e
parent6fd5aa2a678de549f6e6e674c2243bd73e63145e (diff)
Issue #1462772 by fago: Fixed entity template suggestions are not working if no custom template is defined.
-rw-r--r--entity.module9
1 files changed, 9 insertions, 0 deletions
diff --git a/entity.module b/entity.module
index df59079..ef3e7be 100644
--- a/entity.module
+++ b/entity.module
@@ -960,6 +960,14 @@ function entity_flush_caches() {
* Implements hook_theme().
*/
function entity_theme() {
+ // Build a pattern in the form of "type1(\.|__)|type2(\.|__)|..." such that
+ // all templates starting with an entity type or named like the entity type
+ // are found.
+ // This has to match the template suggestions provided in
+ // template_preprocess_entity().
+ $types = array_keys(entity_crud_get_info());
+ $pattern = implode('(\.|__)|', $types) . '\.|__';
+
return array(
'entity_status' => array(
'variables' => array('status' => NULL, 'html' => TRUE),
@@ -967,6 +975,7 @@ function entity_theme() {
'entity' => array(
'render element' => 'elements',
'template' => 'entity',
+ 'pattern' => $pattern,
),
'entity_ui_overview_item' => array(
'variables' => array('label' => NULL, 'entity_type' => NULL, 'url' => FALSE, 'name' => FALSE),