On a clean install of Drupal 7 I get the following notice:
Notice: Undefined variable: forms in custom_pub_forms() (line 85 of [site_root]\sites\all\modules\custom_pub\custom_pub.module).
I am able to add a custom publishing option, and it shows up on the add/edit content form. However, the notice doesn't go away!
My limited brain suggests that it is because the custom_pub_forms() function will not always return the correct type of array as specified here.
I found that if i explicitly set the $forms variable, this fixes the problem and doesn't appear to break anything:
/**
* Implements hook_forms()
*/
function custom_pub_forms($form_id, $args) {
//We need to use this hook because on the admin page there is the possiblity of multiple forms for the edit form. See http://drupal.org/node/354519
$types = variable_get('custom_pub_types', array());
// define $forms in case the following conditions aren't matched
$forms = array();
foreach ($types as $type) {
if ($form_id == 'custom_pub_edit_'.$type['type']) {
$forms[$form_id] = array('callback' => 'custom_pub_edit');
}
}
if ($form_id == 'node_admin_content') {
module_load_include('inc','node', 'node.admin');
$forms['node_admin_content'] = array(
'callback' => 'custom_pub_node_admin_content',
);
}
return $forms;
}
Any ideas what the actual problem is here, and what the *real* fix should be?
Thanks!
Comments
Comment #1
arcaneadam commentedThanks committed fix. http://drupalcode.org/project/custom_pub.git/commit/2d58c98
Comment #2
carl.brown commentedCool. I can confirm your change has fixed the problem for me :) Cheers.