Permalink
Browse files

Fix issue where incorrect elements would be used.

If your view is using an alternate extension and you have elements
that share filenames, the incorrect element would be used.
Fixes #2082
  • Loading branch information...
1 parent bc6de18 commit 049d6e4c76c767bd83a9da80872d2faed583c506 @markstory markstory committed Oct 11, 2011
View
@@ -380,6 +380,9 @@ function element($name, $params = array(), $loadHelpers = false) {
break;
}
}
+ if ($file) {
+ break;
+ }
}
if (is_file($file)) {
@@ -488,6 +488,17 @@ function testElement() {
}
/**
+ * Test that alternate extensions work with duplicated elements.
+ *
+ * @return void
+ */
+ function testElementExtensions() {
+ $this->View->ext = '.xml';
+ $result = $this->View->element('test_element');
+ $this->assertEqual(trim($result), '<p>test element</p>');
+ }
+
+/**
* test that additional element viewVars don't get overwritten with helpers.
*
* @return void
@@ -0,0 +1 @@
+<p>test element</p>

0 comments on commit 049d6e4

Please sign in to comment.