SetGifTransparentColorTrait.php in Image Effects 8.3
File
src/Plugin/ImageToolkit/Operation/SetGifTransparentColorTrait.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation;
use Drupal\Component\Utility\Color;
trait SetGifTransparentColorTrait {
protected function arguments() {
return [
'transparent_color' => [
'description' => 'The RGB hex color for GIF transparency',
'required' => FALSE,
'default' => '#ffffff',
],
];
}
protected function validateArguments(array $arguments) {
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;
}
}