function AttributeBase::get

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

Overrides AttributeInterface::get

1 call to AttributeBase::get()
TestAttribute::get in core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
Gets the value of an attribute.
2 methods override AttributeBase::get()
PluginID::get in core/lib/Drupal/Component/Plugin/Attribute/PluginID.php
Gets the value of an attribute.
TestAttribute::get in core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
Gets the value of an attribute.

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.