Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Having this error on some places inside my drupal installation:
Notice: Undefined index: instance in insert_form_field_ui_field_edit_form_alter() (line 246 of /drupal/sites/all/modules/insert/insert.module).
I fixed it by adding an isset for the $form['instance']
I hope to see this fix added into the module :)
/**
* Implements hook_form_alter().
*/
function insert_form_field_ui_field_edit_form_alter(&$form, $form_state) {
if (isset($form['instance']) && array_key_exists($form['instance']['widget']['type']['#value'], insert_widgets())) {
$field = $form['#field'];
$instance = field_info_instance($form['instance']['entity_type']['#value'], $form['instance']['field_name']['#value'], $form['instance']['bundle']['#value']);
$form['instance']['settings'] += insert_field_widget_settings_form($field, $instance);
}
}
Comment | File | Size | Author |
---|---|---|---|
#7 | insert_php53_merge.patch | 885 bytes | quicksketch |
#6 | insert_php53_merge.patch | 699 bytes | quicksketch |
Comments
Comment #1
Babalu CreditAttribution: Babalu commentedsubscribing
Comment #2
kelutrab11 CreditAttribution: kelutrab11 commentedsub
Comment #3
BenK CreditAttribution: BenK commentedSubscribing
Comment #4
dimitriseng CreditAttribution: dimitriseng commentedHi, I also had this issue in D7 and the suggestion above has removed the error. Can this be reviewed please?
Comment #5
HongPong CreditAttribution: HongPong commentedI had similar PHP notices pop up. Probably a PHP5.3 thing?
Notice: Undefined index: insert in insert_field_widget_settings_form() (line 294 of /insert/insert.module).
Notice: Undefined index: insert_styles in insert_field_widget_settings_form() (line 302 of /insert/insert.module).
Notice: Undefined index: insert_default in insert_field_widget_settings_form() (line 312 of /insert/insert.module).
Notice: Undefined index: insert_class in insert_field_widget_settings_form() (line 319 of /insert/insert.module).
Notice: Undefined index: insert_width in insert_field_widget_settings_form() (line 328 of /insert/insert.module).
Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2251 of /includes/form.inc).
Comment #6
quicksketchYeah we needed a similar fix in FileField Sources recently. This should fix the main issue.
Comment #7
quicksketchHm, actually take that back. Looking at the original issue, it's about $form['instance'] missing, not $form['instance']['settings']. I *think* this patch covers the whole problem as it matches the approach used by FileField Sources
If not, could you describe the situation in which this error occurs? This patch is now in the latest Git repo.