diff --git a/core/core.services.yml b/core/core.services.yml index 346687a..e59f7b9 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -511,8 +511,8 @@ services: image.toolkit.manager: class: Drupal\Core\ImageToolkit\ImageToolkitManager arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@config.factory'] - plugin.manager.image_toolkit_operation: - class: Drupal\system\Plugin\ImageToolkitOperationManager + image.toolkit.operation.manager: + class: Drupal\Core\ImageToolkit\ImageToolkitOperationManager arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] image.toolkit: class: Drupal\Core\ImageToolkit\ImageToolkitInterface diff --git a/core/lib/Drupal/Core/Image/ImageInterface.php b/core/lib/Drupal/Core/Image/ImageInterface.php index 91e8c52..0ef4fc2 100644 --- a/core/lib/Drupal/Core/Image/ImageInterface.php +++ b/core/lib/Drupal/Core/Image/ImageInterface.php @@ -6,7 +6,7 @@ */ namespace Drupal\Core\Image; -use Drupal\system\Plugin\ImageToolkitInterface; +use Drupal\Core\ImageToolkit\ImageToolkitInterface; /** * Provides an interface for image objects. diff --git a/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php b/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php new file mode 100644 index 0000000..1b1eb22 --- /dev/null +++ b/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php @@ -0,0 +1,70 @@ +getToolkitOperationPluginId($this->getPluginId(), $operation); + $plugin = $manager->createInstance($plugin_id); + return $plugin->apply($this, $image, $data); + } + +} diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php new file mode 100644 index 0000000..d6033de --- /dev/null +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php @@ -0,0 +1,36 @@ +alterInfo($module_handler, 'image_toolkit_operation'); + $this->setCacheBackend($cache_backend, $language_manager, 'image_toolkit_operation'); + } + + /** + * Returns the plugin ID for the plugin for a given toolkit and operation. + * + * By convention, the id of an ImageToolkitOperation plugin must look like + * "{toolkit}.{operation}". + * + * @param string $toolkit + * The toolkit ID. + * @param string $operation + * The operation (e.g. "crop"). + * + * @return string + * The plugin ID. + */ + public function getToolkitOperationPluginId($toolkit, $operation) { + return "$toolkit.$operation"; + } + +} diff --git a/core/modules/system/lib/Drupal/system/Annotation/ImageToolkitOperation.php b/core/modules/system/lib/Drupal/system/Annotation/ImageToolkitOperation.php deleted file mode 100644 index 30cb4ad..0000000 --- a/core/modules/system/lib/Drupal/system/Annotation/ImageToolkitOperation.php +++ /dev/null @@ -1,70 +0,0 @@ -getToolkitOperationPluginId($this->getPluginId(), $operation); - $plugin = $manager->createInstance($plugin_id); - return $plugin->apply($this, $image, $data); - } - -} diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitOperationInterface.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitOperationInterface.php deleted file mode 100644 index 82001c8..0000000 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitOperationInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -alterInfo($module_handler, 'image_toolkit_operation'); - $this->setCacheBackend($cache_backend, $language_manager, 'image_toolkit_operation'); - } - - /** - * Returns the plugin ID for the plugin for a given toolkit and operation. - * - * By convention, the id of an ImageToolkitOperation plugin must look like - * "{toolkit}.{operation}". - * - * @param string $toolkit - * The toolkit ID. - * @param string $operation - * The operation (e.g. "crop"). - * - * @return string - * The plugin ID. - */ - public function getToolkitOperationPluginId($toolkit, $operation) { - return "$toolkit.$operation"; - } - -} diff --git a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestCrop.php b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestCrop.php index f51d876..2c3930d 100644 --- a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestCrop.php +++ b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestCrop.php @@ -9,8 +9,8 @@ use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Image\ImageInterface; -use Drupal\system\Plugin\ImageToolkitInterface; -use Drupal\system\Plugin\ImageToolkitOperationInterface; +use Drupal\Core\ImageToolkit\ImageToolkitInterface; +use Drupal\Core\ImageToolkit\ImageToolkitOperationInterface; /** * Defines Test Crop operation. diff --git a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestDesaturate.php b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestDesaturate.php index 644bf79..4fa60ae 100644 --- a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestDesaturate.php +++ b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestDesaturate.php @@ -9,8 +9,8 @@ use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Image\ImageInterface; -use Drupal\system\Plugin\ImageToolkitInterface; -use Drupal\system\Plugin\ImageToolkitOperationInterface; +use Drupal\Core\ImageToolkit\ImageToolkitInterface; +use Drupal\Core\ImageToolkit\ImageToolkitOperationInterface; /** * Defines Test Desaturate operation. diff --git a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestResize.php b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestResize.php index d583a4b..07eea38 100644 --- a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestResize.php +++ b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestResize.php @@ -9,8 +9,8 @@ use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Image\ImageInterface; -use Drupal\system\Plugin\ImageToolkitInterface; -use Drupal\system\Plugin\ImageToolkitOperationInterface; +use Drupal\Core\ImageToolkit\ImageToolkitInterface; +use Drupal\Core\ImageToolkit\ImageToolkitOperationInterface; /** * Defines Test resize operation. diff --git a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestRotate.php b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestRotate.php index be75fe5..1cfc6f6 100644 --- a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestRotate.php +++ b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/ImageToolkit/Operation/TestRotate.php @@ -9,8 +9,8 @@ use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Image\ImageInterface; -use Drupal\system\Plugin\ImageToolkitInterface; -use Drupal\system\Plugin\ImageToolkitOperationInterface; +use Drupal\Core\ImageToolkit\ImageToolkitInterface; +use Drupal\Core\ImageToolkit\ImageToolkitOperationInterface; /** * Defines Test rotate operation.