function Plugin::parse

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Annotation/Plugin.php \Drupal\Component\Annotation\Plugin::parse()
  2. 10 core/lib/Drupal/Component/Annotation/Plugin.php \Drupal\Component\Annotation\Plugin::parse()
  3. 11.x core/lib/Drupal/Component/Annotation/Plugin.php \Drupal\Component\Annotation\Plugin::parse()

Parses an annotation into its definition.

Parameters

array $values: The annotation array.

Return value

array The parsed annotation as a definition.

1 call to Plugin::parse()
Plugin::__construct in core/lib/Drupal/Component/Annotation/Plugin.php
Constructs a Plugin object.

File

core/lib/Drupal/Component/Annotation/Plugin.php, line 54

Class

Plugin
Defines a Plugin annotation object.

Namespace

Drupal\Component\Annotation

Code

protected function parse(array $values) {
    $definitions = [];
    foreach ($values as $key => $value) {
        if ($value instanceof AnnotationInterface) {
            $definitions[$key] = $value->get();
        }
        elseif (is_array($value)) {
            $definitions[$key] = $this->parse($value);
        }
        else {
            $definitions[$key] = $value;
        }
    }
    return $definitions;
}

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