From 6aab2901e1a430c334db4782cd7c019128d2dfb5 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Fri, 28 Feb 2014 10:52:24 +0000 Subject: [PATCH] Issue #2195585 by Les Lim: Add a dedicated @Archiver annotation class. --- .../Core/Archiver/Annotation/Archiver.php | 54 +++++++++++++++++++ .../Drupal/Core/Archiver/ArchiverManager.php | 2 +- .../lib/Drupal/system/Plugin/Archiver/Tar.php | 6 +-- .../lib/Drupal/system/Plugin/Archiver/Zip.php | 6 +-- 4 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 core/lib/Drupal/Core/Archiver/Annotation/Archiver.php diff --git a/core/lib/Drupal/Core/Archiver/Annotation/Archiver.php b/core/lib/Drupal/Core/Archiver/Annotation/Archiver.php new file mode 100644 index 000000000000..553e5071acb5 --- /dev/null +++ b/core/lib/Drupal/Core/Archiver/Annotation/Archiver.php @@ -0,0 +1,54 @@ +<?php + +/** + * @file + * Contains \Drupal\Core\Archiver\Annotation\Archiver. + */ + +namespace Drupal\Core\Archiver\Annotation; + +use Drupal\Component\Annotation\Plugin; + +/** + * Defines an archiver annotation object. + * + * @see \Drupal\Core\Archiver\ArchiverManager + * @see hook_archiver_info_alter() + * + * @Annotation + */ +class Archiver extends Plugin { + + /** + * The archiver plugin ID. + * + * @var string + */ + public $id; + + /** + * The human-readable name of the archiver plugin. + * + * @ingroup plugin_translatable + * + * @var \Drupal\Core\Annotation\Translation + */ + public $title; + + /** + * The description of the archiver plugin. + * + * @ingroup plugin_translatable + * + * @var \Drupal\Core\Annotation\Translation + */ + public $description; + + /** + * An array of valid extensions for this archiver. + * + * @var array + */ + public $extensions; + +} diff --git a/core/lib/Drupal/Core/Archiver/ArchiverManager.php b/core/lib/Drupal/Core/Archiver/ArchiverManager.php index b56d24036855..f446f37a72d3 100644 --- a/core/lib/Drupal/Core/Archiver/ArchiverManager.php +++ b/core/lib/Drupal/Core/Archiver/ArchiverManager.php @@ -31,7 +31,7 @@ class ArchiverManager extends DefaultPluginManager { * The module handler to invoke the alter hook with. */ public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { - parent::__construct('Plugin/Archiver', $namespaces); + parent::__construct('Plugin/Archiver', $namespaces, 'Drupal\Core\Archiver\Annotation\Archiver'); $this->alterInfo($module_handler, 'archiver_info'); $this->setCacheBackend($cache_backend, $language_manager, 'archiver_info_plugins'); } diff --git a/core/modules/system/lib/Drupal/system/Plugin/Archiver/Tar.php b/core/modules/system/lib/Drupal/system/Plugin/Archiver/Tar.php index 0453f169f9d0..faf1fd3b89be 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Archiver/Tar.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Archiver/Tar.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\system\Plugin\Core\Archiver\Tar. + * Contains \Drupal\system\Plugin\Archiver\Tar. */ namespace Drupal\system\Plugin\Archiver; @@ -10,9 +10,9 @@ use Drupal\Component\Archiver\Tar as BaseTar; /** - * Defines a archiver implementation for .tar files. + * Defines an archiver implementation for .tar files. * - * @Plugin( + * @Archiver( * id = "Tar", * title = @Translation("Tar"), * description = @Translation("Handles .tar files."), diff --git a/core/modules/system/lib/Drupal/system/Plugin/Archiver/Zip.php b/core/modules/system/lib/Drupal/system/Plugin/Archiver/Zip.php index 5865653b28ef..2e908b416705 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Archiver/Zip.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Archiver/Zip.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\system\Plugin\Core\Archiver\Zip. + * Contains \Drupal\system\Plugin\Archiver\Zip. */ namespace Drupal\system\Plugin\Archiver; @@ -10,11 +10,11 @@ use Drupal\Component\Archiver\Zip as BaseZip; /** - * Defines a archiver implementation for .zip files. + * Defines an archiver implementation for .zip files. * * @link http://php.net/zip * - * @Plugin( + * @Archiver( * id = "Zip", * title = @Translation("Zip"), * description = @Translation("Handles zip files."), -- GitLab