You are here

class DsAttribute in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/DsAttribute.php \Drupal\ds\DsAttribute
  2. 8.3 src/DsAttribute.php \Drupal\ds\DsAttribute

Extends the core Attribute object.

Hierarchy

Expanded class hierarchy of DsAttribute

1 file declares its use of DsAttribute
ds.module in ./ds.module
Display Suite core functions.

File

src/DsAttribute.php, line 10

Namespace

Drupal\ds
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Attribute::$storage protected property Stores the attribute data.
Attribute::addClass public function Adds classes or merges them on to array of existing CSS classes.
Attribute::createAttributeValue protected function Creates the different types of attribute values.
Attribute::getClass public function Gets the class attribute value if set.
Attribute::getIterator public function
Attribute::hasAttribute public function Checks if the storage has an attribute with the given name.
Attribute::hasClass public function Checks if the class array has the given CSS class.
Attribute::jsonSerialize public function Returns a representation of the object for use in JSON serialization.
Attribute::merge public function Merges an Attribute object into the current storage.
Attribute::offsetExists public function
Attribute::offsetGet public function
Attribute::offsetSet public function
Attribute::offsetUnset public function
Attribute::removeAttribute public function Removes an attribute from an Attribute object.
Attribute::removeClass public function Removes argument values from array of existing CSS classes.
Attribute::setAttribute public function Sets values for an attribute key.
Attribute::storage public function Returns the whole array.
Attribute::toArray public function Returns all storage elements as an array.
Attribute::__clone public function Implements the magic __clone() method.
Attribute::__construct public function Constructs a \Drupal\Core\Template\Attribute object.
Attribute::__toString public function Implements the magic __toString() method. Overrides MarkupInterface::__toString
DsAttribute::mergeAttributes public function Merges Attributes objects into another one.