4 * Contains \Drupal\bootstrap\Annotation\PluginCallback.
7 namespace Drupal\bootstrap\Annotation;
9 use Drupal\bootstrap\Bootstrap;
10 use Drupal\Component\Annotation\AnnotationInterface;
11 use Drupal\Component\Annotation\PluginID;
14 * Defines a Plugin annotation object that just contains an ID.
20 class PluginCallback extends PluginID {
25 * When an annotation is given no key, 'value' is assumed by Doctrine.
32 * Flag that determines how to add the plugin to a callback array.
34 * Must be one of the following constants:
35 * - \Drupal\bootstrap\Bootstrap::CALLBACK_APPEND
36 * - \Drupal\bootstrap\Bootstrap::CALLBACK_PREPEND
37 * - \Drupal\bootstrap\Bootstrap::CALLBACK_REPLACE_APPEND
38 * - \Drupal\bootstrap\Bootstrap::CALLBACK_REPLACE_PREPEND
39 * Use with @ BootstrapConstant annotation.
41 * @see \Drupal\bootstrap\Bootstrap::addCallback()
43 * @var \Drupal\bootstrap\Annotation\BootstrapConstant
45 public $action = Bootstrap::CALLBACK_APPEND;
48 * A callback to replace.
52 public $replace = FALSE;
57 public function get() {
58 $definition = parent::get();
59 $parent_properties = array_keys($definition);
60 $parent_properties[] = 'value';
62 // Merge in the defined properties.
63 $reflection = new \ReflectionClass($this);
64 foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
65 $name = $property->getName();
66 if (in_array($name, $parent_properties)) {
69 $value = $property->getValue($this);
70 if ($value instanceof AnnotationInterface) {
71 $value = $value->get();
73 $definition[$name] = $value;