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);
  }
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Babalu’s picture

subscribing

kelutrab11’s picture

sub

BenK’s picture

Subscribing

dimitriseng’s picture

Status: Active » Needs review

Hi, I also had this issue in D7 and the suggestion above has removed the error. Can this be reviewed please?

HongPong’s picture

I 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).

quicksketch’s picture

Status: Needs review » Fixed
FileSize
699 bytes

Yeah we needed a similar fix in FileField Sources recently. This should fix the main issue.

quicksketch’s picture

FileSize
885 bytes

Hm, 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.