You are here

DsAttribute.php in Display Suite 8.2

Same filename and directory in other branches
  1. 8.4 src/DsAttribute.php
  2. 8.3 src/DsAttribute.php

Namespace

Drupal\ds

File

src/DsAttribute.php
View source
<?php

namespace Drupal\ds;

use Drupal\Core\Template\Attribute;

/**
 * Extends the core Attribute object.
 */
class DsAttribute extends Attribute {

  /**
   * Merges Attributes objects into another one.
   *
   * @return \Drupal\ds\DsAttribute
   *   Merged attributes.
   */
  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;
  }

}

Classes

Namesort descending Description
DsAttribute Extends the core Attribute object.