function AttributeBase::get

Same name in other branches
  1. 11.x core/lib/Drupal/Component/Plugin/Attribute/AttributeBase.php \Drupal\Component\Plugin\Attribute\AttributeBase::get()

Overrides AttributeInterface::get

6 methods override AttributeBase::get()
CKEditor5AspectsOfCKEditor5Plugin::get in core/modules/ckeditor5/src/Attribute/CKEditor5AspectsOfCKEditor5Plugin.php
Gets the value of an attribute.
CKEditor5Plugin::get in core/modules/ckeditor5/src/Attribute/CKEditor5Plugin.php
Gets the value of an attribute.
Layout::get in core/lib/Drupal/Core/Layout/Attribute/Layout.php
Gets the value of an attribute.
PluginID::get in core/lib/Drupal/Component/Plugin/Attribute/PluginID.php
Gets the value of an attribute.
SectionStorage::get in core/modules/layout_builder/src/Attribute/SectionStorage.php
Gets the value of an attribute.

... See full list

File

core/lib/Drupal/Component/Plugin/Attribute/AttributeBase.php, line 68

Class

AttributeBase
Provides a base class for classed attributes.

Namespace

Drupal\Component\Plugin\Attribute

Code

public function get() : array|object {
    return array_filter(get_object_vars($this) + [
        'class' => $this->getClass(),
        'provider' => $this->getProvider(),
    ], function ($value, $key) {
        return !($value === NULL && ($key === 'deriver' || $key === 'provider'));
    }, ARRAY_FILTER_USE_BOTH);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.