Function linkit_form_field_ui_field_edit_form_alter() does not check whether a field is locked or not. Line 125
$allowed_widget = in_array($form['instance']['widget']['type']['#value'], $allowed_widget_types);
generates the following error notice:
Notice: Undefined index: instance in linkit_form_field_ui_field_edit_form_alter() (line 125 of sites\all\modules\linkit\linkit.field.inc).
It might be wise to check if the field is not locked and if the instance is defined:
if (!empty($form['locked']) || empty($form['instance'])) {
return;
}
Thanks for all!
Comments
Comment #1
anonHow do I lock a field?
Comment #2
lmeurs commentedLinkit does not have to lock any fields, other modules apparently do to disallow users to change field settings. Linkit is not aware of a field's
lockedproperty, tries to approach the field and causes a warning.The Field API docs state (https://api.drupal.org/api/drupal/modules%21field%21field.module/group/field/7):
I had to search a bit to find where I encountered the error message: it happened while developing a Drupal Commerce website at
admin/commerce/config/order/fieldswhen altering the Line item (commerce_line_items) and Order total (commerce_order_total) fields. These field are defined by Drupal Commerce and do not allow editing. Drupal does not show a configuration form, but outputs instead:Comment #3
anonOk thanks, I will take a look at this.
Comment #4
anonThis is now fixed for 7.x-3.x.
I'll not fix this for 7.x-2.x now, as that branch soon will be abandoned.