3 namespace Drupal\bootstrap\Annotation;
5 use Drupal\bootstrap\Bootstrap;
6 use Drupal\Component\Annotation\AnnotationInterface;
7 use Drupal\Component\Annotation\PluginID;
10 * Defines a Plugin annotation object that just contains an ID.
16 class PluginCallback extends PluginID {
21 * When an annotation is given no key, 'value' is assumed by Doctrine.
28 * Flag that determines how to add the plugin to a callback array.
30 * @var \Drupal\bootstrap\Annotation\BootstrapConstant
32 * Must be one of the following constants:
33 * - \Drupal\bootstrap\Bootstrap::CALLBACK_APPEND
34 * - \Drupal\bootstrap\Bootstrap::CALLBACK_PREPEND
35 * - \Drupal\bootstrap\Bootstrap::CALLBACK_REPLACE_APPEND
36 * - \Drupal\bootstrap\Bootstrap::CALLBACK_REPLACE_PREPEND
37 * Use with @ BootstrapConstant annotation.
39 * @see \Drupal\bootstrap\Bootstrap::addCallback()
41 public $action = Bootstrap::CALLBACK_APPEND;
44 * A callback to replace.
48 public $replace = FALSE;
53 public function get() {
54 $definition = parent::get();
55 $parent_properties = array_keys($definition);
56 $parent_properties[] = 'value';
58 // Merge in the defined properties.
59 $reflection = new \ReflectionClass($this);
60 foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
61 $name = $property->getName();
62 if (in_array($name, $parent_properties)) {
65 $value = $property->getValue($this);
66 if ($value instanceof AnnotationInterface) {
67 $value = $value->get();
69 $definition[$name] = $value;