trait OpacityTrait in Image Effects 8.3
Same name and namespace in other branches
- 8 src/Plugin/ImageToolkit/Operation/OpacityTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\OpacityTrait
- 8.2 src/Plugin/ImageToolkit/Operation/OpacityTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\OpacityTrait
Base trait for image_effects Opacity operations.
Hierarchy
- trait \Drupal\image_effects\Plugin\ImageToolkit\Operation\OpacityTrait
2 files declare their use of OpacityTrait
- Opacity.php in src/
Plugin/ ImageToolkit/ Operation/ gd/ Opacity.php - Opacity.php in src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ Opacity.php
File
- src/
Plugin/ ImageToolkit/ Operation/ OpacityTrait.php, line 8
Namespace
Drupal\image_effects\Plugin\ImageToolkit\OperationView source
trait OpacityTrait {
/**
* {@inheritdoc}
*/
protected function arguments() {
return [
'opacity' => [
'description' => 'Opacity.',
'required' => FALSE,
'default' => 100,
],
];
}
/**
* {@inheritdoc}
*/
protected function validateArguments(array $arguments) {
// Ensure opacity is in the range 0-100.
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpacityTrait:: |
protected | function | ||
OpacityTrait:: |
protected | function |