4

I have a developed custom plugin in my Drupal 7.54 site for panels where user can upload image. It works locally, however when I trigger same functionality on production nothing happens and I see in logs following errors.

Notice: Undefined index: hero_block_search_box_edit_form in drupal_retrieve_form() (line 807 of /Users/dpa/Sites/e1/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'hero_block_search_box_edit_form' not found or invalid function name in drupal_retrieve_form() (line 842 of 
/Users/dpa/Sites/e1/includes/form.inc).
Notice: Undefined index: content in file_ajax_upload() (line 271 of /Users/dpa/Sites/e1/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /Users/dpa/Sites/econ-websites/econ1/modules/file/file.module).
Notice: Undefined index: #prefix in file_ajax_upload() (line 283 of /Users/dpa/Sites/econ-websites/econ1/modules/file/file.module).

I read about similar issues in google any many people say it could be related to permissions (and it has sense, since locally everything works but not on production side).

Would anybody give me a hint where to look?

2
  • What is the name of the file that has the function hero_block_search_box_edit_form?
    – Jaypan
    Commented Feb 8, 2017 at 15:02
  • @Jaypan thanks for comment, the name of the file is hero_block_search_box.inc Commented Feb 9, 2017 at 8:44

1 Answer 1

3

You need to either move hero_block_search_box_edit_form() from hero_block_search_box.inc to your .module file, or at the top of your form definition (or hook_form_alter() if that's what you are using), you need to add the following:

form_load_include($form_state, 'inc', MODULENAME, 'hero_block_search_box');

where MODULENAME is the module key (machine name) of your module. Make sure you don't include the .inc in the last parameter - I didn't forget it, I left it out on purpose.

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.