From b32ced1a758a1cc53e48bf6fdbc868ef32419e56 Mon Sep 17 00:00:00 2001
From: Joost van der Locht <joost@trisum.nl>
Date: Mon, 21 Mar 2011 22:44:50 +0100
Subject: [PATCH 42/42] BUG: templating system

---
 field-collection-item.tpl.php |   37 +++++++++++++++++++++++++++++++++++++
 field_collection.module       |    3 ++-
 field_collection_item.tpl.php |   37 -------------------------------------
 3 files changed, 39 insertions(+), 38 deletions(-)
 create mode 100644 field-collection-item.tpl.php
 delete mode 100644 field_collection_item.tpl.php

diff --git a/field-collection-item.tpl.php b/field-collection-item.tpl.php
new file mode 100644
index 0000000..b14dd95
--- /dev/null
+++ b/field-collection-item.tpl.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * @file
+ * Default theme implementation for field-collection items.
+ *
+ * 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) field-collection item 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-field-collection-item
+ *   - field-collection-item-{field_name}
+ *
+ * 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()
+ */
+?>
+<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
+  <div class="content"<?php print $content_attributes; ?>>
+    <?php
+      print render($content);
+    ?>
+  </div>
+</div>
diff --git a/field_collection.module b/field_collection.module
index 82d5e19..300390f 100644
--- a/field_collection.module
+++ b/field_collection.module
@@ -452,7 +452,8 @@ function field_collection_theme() {
   return array(
     'field_collection_item' => array(
       'render element' => 'elements',
-      'template' => 'field_collection_item',
+      'template' => 'field-collection-item',
+      'pattern' => 'field_collection_item__',
     ),
     'field_collection_view' => array(
       'render element' => 'element',
diff --git a/field_collection_item.tpl.php b/field_collection_item.tpl.php
deleted file mode 100644
index b14dd95..0000000
--- a/field_collection_item.tpl.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * @file
- * Default theme implementation for field-collection items.
- *
- * 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) field-collection item 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-field-collection-item
- *   - field-collection-item-{field_name}
- *
- * 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()
- */
-?>
-<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
-  <div class="content"<?php print $content_attributes; ?>>
-    <?php
-      print render($content);
-    ?>
-  </div>
-</div>
-- 
1.7.4.1

