The image module does not implement the hook_hook_info() hook, and does not define groups.
Therefore each hook_image_xxx() implementation must be in the *.module file.
The image module put the self hook_image_effect_info() implementation into the image.effect.inc file,
and when it is necessary include it. See the image_effect_definitions().
I think this is not the right way to include a file.
include_once DRUPAL_ROOT . '/modules/image/image.effects.inc';
Has no chance to other modules to do the same.
The image_effect_form() call the "form callback" callback function to get the settings widget of the effect, but does not include any file before. This is not necessary for the image module, because each "form callback" of the image module effects are in same file. (image.admin.inc)
Same situation with the "effect callback".
The image_effect_apply() function only include the image.effect.inc file.
Other modules must be implement the "effect callback" callback in the *.module file.
For performance purposes, this is not the best.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 954796-image-hook-info.patch | 785 bytes | agentrickard |
| #3 | effects.zip | 4.27 KB | nevergone |
| #1 | drupal-954796.patch | 6.63 KB | sweetchuck |
Comments
Comment #1
sweetchuckQuick patch
Comment #2
nevergoneThis is bug is exist.
The patch is correct and repairs the bug.
Comment #3
nevergoneSimple module for testing.
Comment #4
marcingy commentedThis is d8 material.
Comment #5
sweetchuckThis feature is available in D6 imagecache.
http://drupalcontrib.org/api/function/hook_imagecache_actions/6
"file": the name of the include file the action can be found in relative to the implementing module's path.
Comment #6
sweetchuck@marcingy : Can you imagine how will looks like the imagecache_action module (and submodules) in D7?
Just the imagecache_action module define ~15 different actions, with settings forms and with form validations and etc...
Comment #7
marcingy commentedImagecache is not in core - this a feature request and d8.
Comment #8
nevergoneBug fixing is feature request? Imagecache is not in core, but Image module is yes.
This is bug and fixable, even in a later release.
But not D8.
Comment #9
marcingy commentedIt isn't a bug it is a feature request - this adding additional functionality to core and hence d8 material. Imagecache may have offered this feature but as that was a contrib module this can not be considered a regression in my opinion. The reason why I say it isn't a bug is because image styles work without issue in core, and this is an ehancement (ie feature request).
Comment #10
marcingy commentedAnd the patch needs work as the format it has been rolled using is pretty unreadable.
Comment #11
marcingy commentedPushing back to d8.
Comment #12
agentrickardAnd a new patch. Note that actually moving implementations of this hook is another issue.
Comment #13
agentrickardTagging and properly prioritizing.
Comment #14
valthebaldShouldn't ability to place image hooks in separate file be mentioned in image.api.php?
Comment #15
claudiu.cristeaAfter image D8 conversion all new class are autoloaded. Effects are plugins, also autoloaded. This issues has lost it's scope. Thank you for the work.