Issue #1969708 by dawehner, tim.plunkett: Add a dedicated annotation for @ImageToolkit plugins.
parent
58d8e35c38
commit
4784baff4f
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Annotation\ImageToolkit.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* Defines a Plugin annotation object for the image toolkit plugin.
|
||||
*
|
||||
* @Annotation
|
||||
*
|
||||
* @see \Drupal\system\Plugin\ImageToolkitInterface
|
||||
* @see \Drupal\system\Plugin\ImageToolkitManager
|
||||
*/
|
||||
class ImageToolkit extends Plugin {
|
||||
|
||||
/**
|
||||
* The plugin ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* The title of the image toolkit.
|
||||
*
|
||||
* The string should be wrapped in a @Translation().
|
||||
*
|
||||
* @ingroup plugin_translatable
|
||||
*
|
||||
* @var \Drupal\Core\Annotation\Translation
|
||||
*/
|
||||
public $title;
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\system\Plugin\ImageToolkit;
|
||||
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
use Drupal\system\Annotation\ImageToolkit;
|
||||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
use Drupal\system\Plugin\ImageToolkitInterface;
|
||||
|
@ -16,7 +16,7 @@ use Drupal\system\Plugin\ImageToolkitInterface;
|
|||
/**
|
||||
* Defines the GD2 toolkit for image manipulation within Drupal.
|
||||
*
|
||||
* @Plugin(
|
||||
* @ImageToolkit(
|
||||
* id = "gd",
|
||||
* title = @Translation("GD2 image manipulation toolkit")
|
||||
* )
|
||||
|
|
|
@ -28,7 +28,8 @@ class ImageToolkitManager extends DefaultPluginManager {
|
|||
* The language manager.
|
||||
*/
|
||||
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager) {
|
||||
parent::__construct('Plugin/ImageToolkit', $namespaces);
|
||||
$annotation_namespaces = array('Drupal\system\Annotation' => $namespaces['Drupal\system']);
|
||||
parent::__construct('Plugin/ImageToolkit', $namespaces, $annotation_namespaces, 'Drupal\system\Annotation\ImageToolkit');
|
||||
$this->setCacheBackend($cache_backend, $language_manager, 'image_toolkit');
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
namespace Drupal\image_test\Plugin\ImageToolkit;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
use Drupal\system\Annotation\ImageToolkit;
|
||||
use Drupal\Core\Annotation\Translation;
|
||||
|
||||
/**
|
||||
* Defines a Test toolkit for image manipulation within Drupal.
|
||||
*
|
||||
* @Plugin(
|
||||
* @ImageToolkit(
|
||||
* id = "broken",
|
||||
* title = @Translation("A dummy toolkit that is broken")
|
||||
* )
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\image_test\Plugin\ImageToolkit;
|
||||
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
use Drupal\system\Annotation\ImageToolkit;
|
||||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Image\ImageInterface;
|
||||
use Drupal\system\Plugin\ImageToolkitInterface;
|
||||
|
@ -16,7 +16,7 @@ use Drupal\system\Plugin\ImageToolkitInterface;
|
|||
/**
|
||||
* Defines a Test toolkit for image manipulation within Drupal.
|
||||
*
|
||||
* @Plugin(
|
||||
* @ImageToolkit(
|
||||
* id = "test",
|
||||
* title = @Translation("A dummy toolkit that works")
|
||||
* )
|
||||
|
|
Loading…
Reference in New Issue