diff --git a/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php b/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php index bd5250d..1e9b9d8 100644 --- a/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php +++ b/core/lib/Drupal/Core/ImageToolkit/Annotation/ImageToolkitOperation.php @@ -21,7 +21,17 @@ class ImageToolkitOperation extends Plugin { /** * The plugin ID. * - * Use {toolkit}.{operation} pattern. + * There are no strict requirements as to the string to be used to identify + * the plugin, since discovery of the appropriate operation plugin to be + * used to apply an operation is based on the values of the 'toolkit' and + * of the 'operation' definition keys. The 'toolkit' definition key is + * derived from the class namespace, while the 'operation' key is annotated. + * However, it is recommended that the following patterns be used: + * - '{toolkit}.{operation}' for the first implementation of an operation + * by a toolkit. + * - '{module}.{toolkit}.{operation}' for overrides of existing + * implementations supplied by an alternative module, and for new + * module-supplied operations. * * @var string */ diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php index 1b34a71..5b9a80b 100644 --- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php @@ -39,7 +39,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array(); } @@ -47,7 +47,7 @@ public function defaultConfiguration() { * {@inheritdoc} */ public function prepare(ImageInterface $image, array &$arguments) { - foreach ($this->defaultConfiguration() as $id => $argument) { + foreach ($this->argumentsDefinition() as $id => $argument) { $argument += array('required' => TRUE); // Check if the defined argument has been provided. if (!array_key_exists($id, $arguments)) { diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php index 5f864d0..eaa3d14 100644 --- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationInterface.php @@ -20,7 +20,7 @@ interface ImageToolkitOperationInterface extends PluginInspectionInterface { /** - * Returns the default configuration of the operation arguments. + * Returns the definition of the operation arguments. * * An array whose keys are the names of the arguments (e.g. "width", * "degrees") and each value is an associative array having the following @@ -36,7 +36,7 @@ * * @return array */ - public function defaultConfiguration(); + public function argumentsDefinition(); /** * Validates, normalizes and adds defaults to arguments before sending them diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php index 86128b9..3055c3c 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Crop.php @@ -25,7 +25,7 @@ class Crop extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'x' => array( 'description' => 'The starting x offset at which to start the crop, in pixels', diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Desaturate.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Desaturate.php index e2312ed..a46fb5d 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Desaturate.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Desaturate.php @@ -25,13 +25,6 @@ class Desaturate extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { - return array(); - } - - /** - * {@inheritdoc} - */ public function apply(ImageInterface $image, array $arguments = array()) { // PHP installations using non-bundled GD do not have imagefilter. if (!function_exists('imagefilter')) { diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php index 8b734f5..ff959ca 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php @@ -25,7 +25,7 @@ class Resize extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The new width of the resized image, in pixels', diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php index 6e0bf0d..da65d4d 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Rotate.php @@ -25,7 +25,7 @@ class Rotate extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'degrees' => array( 'description' => 'The number of (clockwise) degrees to rotate the image', diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php index 4512e63..f7d1c30 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Scale.php @@ -25,7 +25,7 @@ class Scale extends Resize { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The target width, in pixels. This value is omitted then the scaling will based only on the height value', diff --git a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php index 1da80b9..e841a90 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php +++ b/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/ScaleAndCrop.php @@ -25,7 +25,7 @@ class ScaleAndCrop extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The target width, in pixels', diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Crop.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Crop.php index ab38c10..ef21649 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Crop.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Crop.php @@ -25,7 +25,7 @@ class Crop extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'x' => array( 'description' => 'The starting x offset at which to start the crop, in pixels', diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Desaturate.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Desaturate.php index 5791c4d..04b7542 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Desaturate.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Desaturate.php @@ -25,13 +25,6 @@ class Desaturate extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { - return array(); - } - - /** - * {@inheritdoc} - */ public function apply(ImageInterface $image, array $arguments = array()) { $this->toolkit->logCall('desaturate', array($image)); return TRUE; diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Resize.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Resize.php index 0a1bc3e..51868c8 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Resize.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Resize.php @@ -25,7 +25,7 @@ class Resize extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The new width of the resized image, in pixels', diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Rotate.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Rotate.php index a367d38..572cd37 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Rotate.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Rotate.php @@ -25,7 +25,7 @@ class Rotate extends ImageToolkitOperationBase { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'degrees' => array( 'description' => 'The number of (clockwise) degrees to rotate the image', diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Scale.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Scale.php index 2bb77d9..46ff442 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Scale.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Scale.php @@ -24,7 +24,7 @@ class Scale extends Resize { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The target width, in pixels. This value is omitted then the scaling will based only on the height value', diff --git a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/ScaleAndCrop.php b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/ScaleAndCrop.php index 2334b7a..c9b10cf 100644 --- a/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/ScaleAndCrop.php +++ b/core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/ScaleAndCrop.php @@ -24,7 +24,7 @@ class ScaleAndCrop extends Crop { /** * {@inheritdoc} */ - public function defaultConfiguration() { + public function argumentsDefinition() { return array( 'width' => array( 'description' => 'The target width, in pixels',