summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Carver2019-01-21 20:03:51 (GMT)
committerMark Carver2019-01-21 20:03:51 (GMT)
commit41194a9f826693e94ad8220998e41545deec6677 (patch)
tree9da34261639d7017df993889e6e45ec084c7139e
parent51e6d0b2b7f8f4b9e324694c252d84de440de45a (diff)
Issue #3020266 by markcarver, mlanth, Lennard Westerveld: CSS Classes attributes not compatible with object from \Drupal\Core\Template\Attribute
-rw-r--r--src/Utility/Attributes.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Utility/Attributes.php b/src/Utility/Attributes.php
index b603298..6b1e358 100644
--- a/src/Utility/Attributes.php
+++ b/src/Utility/Attributes.php
@@ -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));
}