Issue #3020266 by markcarver, mlanth, Lennard Westerveld: CSS Classes...

Issue #3020266 by markcarver, mlanth, Lennard Westerveld: CSS Classes attributes not compatible with object from \Drupal\Core\Template\Attribute
parent 51e6d0b2
......@@ -2,6 +2,8 @@
namespace Drupal\bootstrap\Utility;
use Drupal\Core\Template\AttributeValueBase;
/**
* Class to help modify attributes.
*
......@@ -25,6 +27,11 @@ class Attributes extends ArrayObject {
* @see \Drupal\bootstrap\Utility\Attributes::getClasses()
*/
public function addClass($class) {
// Handle core Attribute based object values.
// @see https://www.drupal.org/project/bootstrap/issues/3020266
if ($class instanceof AttributeValueBase) {
$class = $class->value();
}
$classes = &$this->getClasses();
$classes = array_unique(array_merge($classes, (array) $class));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment