Skip to content
Snippets Groups Projects
Commit 93173604 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1805776 by psynaptic, Eric_A, rbayliss: Fixed Fatal error: Class...

Issue #1805776 by psynaptic, Eric_A, rbayliss: Fixed Fatal error: Class 'Drupal\Core\Template\ArrayIterator' not found in core/lib/Drupal/Core/Template/Attribute.php.
parent ce9c71f6
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,6 @@
namespace Drupal\Core\Template;
use ArrayAccess;
use IteratorAggregate;
/**
* A class that can be used for collecting then rendering HTML attributtes.
......@@ -32,7 +30,7 @@
* // Produces <cat class="cat black-cat white-cat black-white-cat" id="socks">
* @endcode
*/
class Attribute implements ArrayAccess, IteratorAggregate {
class Attribute implements \ArrayAccess, \IteratorAggregate {
/**
* Stores the attribute data.
......@@ -129,7 +127,7 @@ public function __clone() {
* Implements IteratorAggregate::getIterator().
*/
public function getIterator() {
return new ArrayIterator($this->storage);
return new \ArrayIterator($this->storage);
}
/**
......
......@@ -7,8 +7,6 @@
namespace Drupal\Core\Template;
use ArrayAccess;
use IteratorAggregate;
/**
* A class that defines a type of Attribute that can be added to as an array.
......@@ -28,7 +26,7 @@
*
* @see Drupal\Core\Template\Attribute
*/
class AttributeArray extends AttributeValueBase implements ArrayAccess, IteratorAggregate {
class AttributeArray extends AttributeValueBase implements \ArrayAccess, \IteratorAggregate {
/**
* Implements ArrayAccess::offsetGet().
......@@ -75,7 +73,7 @@ public function __toString() {
* Implements IteratorAggregate::getIterator().
*/
public function getIterator() {
return new ArrayIterator($this->value);
return new \ArrayIterator($this->value);
}
/**
......
......@@ -47,5 +47,11 @@ function testDrupalAttributes() {
// Verify empty attributes array is rendered.
$this->assertIdentical((string) new Attribute(array()), '', 'Empty attributes array.');
$attributes_array = array('key1' => 'value1');
$attribute = new Attribute($attributes_array);
foreach($attribute as $value) {
$this->assertIdentical((string) $value, 'value1', 'Iterate over attribute.');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment