Commit a78b614f authored by alexpott's avatar alexpott

Issue #1967406 by tim.plunkett: Add a dedicated @Tip annotation.

parent 00511761
<?php
/**
* @file
* Contains \Drupal\tour\Annotation\Tip.
*/
namespace Drupal\tour\Annotation;
use Drupal\Component\Annotation\PluginID;
/**
* Defines a Tip annotation object.
*
* @Annotation
*/
class Tip extends PluginID {
/**
* The plugin ID.
*
* @var string
*/
public $id;
}
......@@ -7,16 +7,13 @@
namespace Drupal\tour\Plugin\tour\tip;
use Drupal\Component\Annotation\Plugin;
use Drupal\tour\Annotation\Tip;
use Drupal\tour\TipPluginBase;
/**
* Displays some text as a tip.
*
* @Plugin(
* id = "text",
* module = "tour"
* )
* @Tip("text")
*/
class TipPluginText extends TipPluginBase {
......
......@@ -26,7 +26,8 @@ class TipPluginManager extends PluginManagerBase {
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('tour', 'tip', $namespaces);
$annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour']);
$this->discovery = new AnnotatedClassDiscovery('tour', 'tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
$this->discovery = new CacheDecorator($this->discovery, 'tour');
$this->factory = new DefaultFactory($this->discovery);
......
......@@ -7,16 +7,13 @@
namespace Drupal\tour_test\Plugin\tour\tip;
use Drupal\Component\Annotation\Plugin;
use Drupal\tour\Annotation\Tip;
use Drupal\tour\TipPluginBase;
/**
* Displays an image as a tip.
*
* @Plugin(
* id = "image",
* module = "tour_test"
* )
* @Tip("image")
*/
class TipPluginImage extends TipPluginBase {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment