I have created a custom module that declares a custom image formatter. Now I need to call the Core image module preprocess function ‘template_preprocess_image_formatter’. How would I do that?
I tried to add it in the list of preprocess functions of my custom theme but it doesn’t fire unless I clear the cache:
/** * Implements hook_theme(). */ function foo_theme() { 'image_formatter_foo' => [ 'variables' => ['item' => NULL, 'item_attributes' => NULL, 'image_style' => NULL], 'file' => 'foo.field.inc', 'preprocess functions' => [ 'template_preprocess_image', 'template_preprocess_image_formatter_foo' ] ], }
Sponsored by SupremePR