PluginExample.php

Same filename in this branch
  1. 11.x core/modules/system/tests/modules/plugin_test/src/Plugin/Attribute/PluginExample.php
Same filename and directory in other branches
  1. 9 core/modules/system/tests/modules/plugin_test/src/Plugin/Annotation/PluginExample.php
  2. 8.9.x core/modules/system/tests/modules/plugin_test/src/Plugin/Annotation/PluginExample.php
  3. 10 core/modules/system/tests/modules/plugin_test/src/Plugin/Attribute/PluginExample.php
  4. 10 core/modules/system/tests/modules/plugin_test/src/Plugin/Annotation/PluginExample.php

Namespace

Drupal\plugin_test\Plugin\Annotation

File

core/modules/system/tests/modules/plugin_test/src/Plugin/Annotation/PluginExample.php

View source
<?php

namespace Drupal\plugin_test\Plugin\Annotation;

use Drupal\Component\Annotation\AnnotationBase;

/**
 * Defines a custom Plugin annotation.
 *
 * @Annotation
 */
class PluginExample extends AnnotationBase {
    
    /**
     * The plugin ID.
     *
     * @var string
     */
    public $id;
    
    /**
     * Another plugin metadata.
     *
     * @var string
     */
    public $custom;
    
    /**
     * {@inheritdoc}
     */
    public function get() {
        return [
            'id' => $this->id,
            'custom' => $this->custom,
            'class' => $this->class,
            'provider' => $this->provider,
        ];
    }

}

Classes

Title Deprecated Summary
PluginExample Defines a custom Plugin annotation.

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