function AttributeClassDiscovery::prepareAttributeDefinition

Same name in this branch
  1. 11.x core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::prepareAttributeDefinition()
Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::prepareAttributeDefinition()
  2. 10 core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::prepareAttributeDefinition()

Overrides AttributeClassDiscovery::prepareAttributeDefinition

File

core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php, line 65

Class

AttributeClassDiscovery
Defines a discovery mechanism to find plugins using attributes.

Namespace

Drupal\Core\Plugin\Discovery

Code

protected function prepareAttributeDefinition(AttributeInterface $attribute, string $class) : void {
    parent::prepareAttributeDefinition($attribute, $class);
    if (!$attribute->getProvider()) {
        $attribute->setProvider($this->getProviderFromNamespace($class));
    }
}

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