public function DsAttribute::mergeAttributes in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/DsAttribute.php \Drupal\ds\DsAttribute::mergeAttributes()
- 8.3 src/DsAttribute.php \Drupal\ds\DsAttribute::mergeAttributes()
Merges Attributes objects into another one.
Return value
\Drupal\ds\DsAttribute Merged attributes.
File
- src/
DsAttribute.php, line 18
Class
- DsAttribute
- Extends the core Attribute object.
Namespace
Drupal\dsCode
public function mergeAttributes() {
$args = func_get_args();
if ($args) {
$merged_array = $this
->toArray();
foreach ($args as $arg) {
if (is_object($arg)) {
$merged_array = array_merge_recursive($merged_array, $arg
->toArray());
}
}
foreach ($merged_array as $attribute => $value) {
$this
->setAttribute($attribute, $value);
}
}
return $this;
}