MirrorTrait.php in Image Effects 8
File
src/Plugin/ImageToolkit/Operation/MirrorTrait.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation;
trait MirrorTrait {
protected function arguments() {
return [
'x_axis' => [
'description' => 'Flop the source image horizontally.',
'required' => FALSE,
'default' => FALSE,
],
'y_axis' => [
'description' => 'Flip the source image vertically.',
'required' => FALSE,
'default' => FALSE,
],
];
}
protected function validateArguments(array $arguments) {
$arguments['x_axis'] = (bool) $arguments['x_axis'];
$arguments['y_axis'] = (bool) $arguments['y_axis'];
if ($arguments['x_axis'] === FALSE && $arguments['y_axis'] === FALSE) {
throw new \InvalidArgumentException("Neither horizontal flop nor vertical flip is specified for the image 'mirror' operation");
}
return $arguments;
}
}
Traits
Name |
Description |
MirrorTrait |
Base trait for image_effects Mirror operations. |