Commit 4360c8af authored by mondrake's avatar mondrake Committed by mondrake

Issue #3020042 by mondrake: Prepare for Image Effects x.3

parent cb5e00ae
...@@ -2,39 +2,53 @@ ...@@ -2,39 +2,53 @@
Contributions to the module are welcome! Contributions to the module are welcome!
* Issues should be filed at [Drupal.org]. Issues and patches should be filed at [Drupal.org].
* Code changes can be submitted in the patch form and uploaded to the Drupal.org
issue or as a [GitHub pull request].
## Contributing a new image effect ## Contributing a new image effect
Please note that in order to keep the codebase clean, the code for new image effects Please note that in order to keep the codebase clean, the code for new image
in this module need to follow the [Drupal coding standards]. Only patches that fulfill effects in this module need to follow the [Drupal coding standards]. Only
the PHPCS checks will be committed. patches that fulfill the PHPCS checks will be committed.
In addition, there are some specific rules for the image effects and the image toolkit In addition, there are some specific rules for the image effects and the image
operations that need to be obeyed to keep your code reviewable and maintainable in the toolkit operations that need to be obeyed to keep your code reviewable and
future. maintainable in the future.
New effects **MUST HAVE**: New effects **MUST HAVE**:
1. an entry in the ```README.md``` table where effects are listed, including applicable toolkits 1. an entry in the `README.md` table where effects are listed, including
2. a class name (and file) that follows the ```[Effect]ImageEffect``` naming convention applicable toolkits
2. an ```id``` in the plugin annotation that follows the ```image_effects_[effect]``` naming convention 2. a class name (and file) that follows the `[Effect]ImageEffect` naming
3. an appropriate config schema entry in ```config/schema/image_effects.schema.yml```, even if the effect has no parameters convention
4. an implementation of ```::transformDimensions``` if the effect changes height/width of the image 2. an `id` in the plugin annotation that follows the `image_effects_[effect]`
naming convention
3. an appropriate config schema entry in
`config/schema/image_effects.schema.yml`, even if the effect has no parameters
4. an implementation of `::transformDimensions` if the effect changes
height/width of the image
5. if the effect has parameters: 5. if the effect has parameters:
1. an ```image_effects_[effect]_summary``` entry in ```image_effects_theme()``` in ```image_effects.module``` 1. an `image_effects_[effect]_summary` entry in `image_effects_theme()` in `image_effects.module`
2. a Twig template for the effect summary under ```templates/image-effects-[effect]-summary.html.twig``` 2. a Twig template for the effect summary under
3. the effect form using ```'#type' => 'image_effects_color'``` form elements to capture color information where needed `templates/image-effects-[effect]-summary.html.twig`
4. the effect form using the image selector plugin to capture an image file URL if necessary 3. the effect form using `'#type' => 'image_effects_color'` form elements to
5. the effect form using the font selector plugin to capture a font file URL if necessary capture color information where needed
6. the effect form using ```'#type' => 'image_effects_px_perc'``` form elements to capture information that can be expressed either as an absolute number or as a percentage 4. the effect form using the image selector plugin to capture an image file
URL if necessary
5. the effect form using the font selector plugin to capture a font file URL
if necessary
6. the effect form using `'#type' => 'image_effects_px_perc'` form elements
to capture information that can be expressed either as an absolute number or
as a percentage
6. if image toolkit operation plugins are needed: 6. if image toolkit operation plugins are needed:
1. a trait with ```::arguments``` and ```::validateArguments``` if image toolkit operations are implemented, so that the toolkit specific code resides only in the ```::execute``` method of the operation 1. a trait with `::arguments` and `::validateArguments` if image toolkit
2. implementations of operations for both GD and ImageMagick toolkits - if a toolkit cannot support the operation, the implementation should be a no-op returning TRUE operations are implemented, so that the toolkit specific code resides only
7. a PHPUnit functional effect test extending from ```ImageEffectsTestBase```, testing both toolkits, in the `::execute` method of the operation
testing changes of size if the effect does so (both for ```::applyEffect``` and ```::transformDimensions```), and doing pixel level testing of the resulting image if possible 2. implementations of operations for both GD and ImageMagick toolkits - if a
toolkit cannot support the operation, the implementation should be a no-op
returning TRUE
7. a PHPUnit functional effect test extending from `ImageEffectsTestBase`,
testing both toolkits, testing changes of size if the effect does so (both for
`::applyEffect` and `::transformDimensions`), and doing pixel level testing of
the resulting image if possible
[Drupal.org]: https://drupal.org/project/issues/image_effects [Drupal.org]: https://drupal.org/project/issues/image_effects
[GitHub pull request]: https://github.com/drupal-media/image_effects/pulls
[Drupal coding standards]: https://www.drupal.org/docs/develop/standards [Drupal coding standards]: https://www.drupal.org/docs/develop/standards
...@@ -52,3 +52,10 @@ function image_effects_update_8201() { ...@@ -52,3 +52,10 @@ function image_effects_update_8201() {
function image_effects_update_8202() { function image_effects_update_8202() {
// Empty function. // Empty function.
} }
/**
* Clear caches to discover new effects.
*/
function image_effects_update_8203() {
// Empty function.
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment