function slickgrid_field_attach_validate in Slickgrid 7.2
Implements hook_field_attach_validate().
This is simply here to prevent errors when editing an entity that was associated with a term that has been deleted.
This error is to prevent errors being thrown under the following situation:
- Create term
- Associate term with entity
- Delete term
- Edit term in slickgrid, but editing a different field.
These would normally be prevented because the values in a taxonomy field do not include links to terms that have been deleted.
File
- ./
slickgrid.module, line 672
Code
function slickgrid_field_attach_validate($entity_type, $entity, &$errors) {
if ($_GET['q'] == 'slickgrid/callback/update') {
foreach ($errors as $key => $value) {
// Check if the $key is a taxonomy field, and if it is, we remove the
// error.
$field = field_info_field($key);
if ($field['type'] == 'taxonomy_term_reference') {
unset($errors[$key]);
}
}
}
}