OpacityTrait.php in Image Effects 8.2
File
src/Plugin/ImageToolkit/Operation/OpacityTrait.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation;
trait OpacityTrait {
protected function arguments() {
return [
'opacity' => [
'description' => 'Opacity.',
'required' => FALSE,
'default' => 100,
],
];
}
protected function validateArguments(array $arguments) {
if (!is_numeric($arguments['opacity']) || $arguments['opacity'] > 100 || $arguments['opacity'] < 0) {
throw new \InvalidArgumentException("Invalid opacity ('{$arguments['opacity']}') specified for the image 'opacity' operation");
}
return $arguments;
}
}