trait SetGifTransparentColorTrait in Image Effects 8.3
Same name and namespace in other branches
- 8 src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\SetGifTransparentColorTrait
- 8.2 src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\SetGifTransparentColorTrait
Base trait for set_gif_transparent_color image operations.
Hierarchy
- trait \Drupal\image_effects\Plugin\ImageToolkit\Operation\SetGifTransparentColorTrait
2 files declare their use of SetGifTransparentColorTrait
- SetGifTransparentColor.php in src/
Plugin/ ImageToolkit/ Operation/ gd/ SetGifTransparentColor.php - SetGifTransparentColor.php in src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ SetGifTransparentColor.php
File
- src/
Plugin/ ImageToolkit/ Operation/ SetGifTransparentColorTrait.php, line 10
Namespace
Drupal\image_effects\Plugin\ImageToolkit\OperationView source
trait SetGifTransparentColorTrait {
/**
* {@inheritdoc}
*/
protected function arguments() {
return [
'transparent_color' => [
'description' => 'The RGB hex color for GIF transparency',
'required' => FALSE,
'default' => '#ffffff',
],
];
}
/**
* {@inheritdoc}
*/
protected function validateArguments(array $arguments) {
// Assure transparent color is a valid hex string.
if ($arguments['transparent_color'] && !Color::validateHex($arguments['transparent_color'])) {
$transparent_color = $arguments['transparent_color'];
throw new \InvalidArgumentException("Invalid transparent color ({$transparent_color}) specified for the image 'set_gif_transparent_color' operation");
}
return $arguments;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SetGifTransparentColorTrait:: |
protected | function | ||
SetGifTransparentColorTrait:: |
protected | function |