0
function my_module_name_image_effect_info_alter(&$effects) {
    $effects += array(
        'whatever' => array(
            'label' => t('blabla'),
            'help' => t('Everything you need to know about this effect'),
            'effect callback'=> 'function_I_wrote',
            'dimensions callback'=> 'another_function_I_wrote',
            'form callback'=> 'image_resize_form', //This one is sufficient
            'summary theme'=> 'image_resize_summary', //No need for own summary
            'module'=> 'image', //dunno?
            'name'=> 'image_rotate', //this is where my question is about
            'data'=> []
        )
    ); 
}

So I was looking at https://api.drupal.org/api/drupal/modules!image!image.api.php/function/hook_image_effect_info/7

They don't even mention name, but without it I get error:

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value

And if I specify my own name it doen't show up under the Image styles effect section after adding. Using an existing one gives it that name. So my guess it's some kind of constant. Where does it come from?

1 Answer 1

0

First of all: I think the alter method should not exist if this is the easier way.

Call hook_image_effect_info() and just pass

label, help, effect callback, dimension callback and form callback

this way it won't ask for

name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.