function list_field_update_forbid
list_field_update_forbid($field, $prior_field, $has_data)
Implements hook_field_update_forbid().
File
- modules/field/modules/list/list.module, line 358
- Defines list field types that can be used with the Options module.
Code
function list_field_update_forbid($field, $prior_field, $has_data) { if ($field['module'] == 'list' && $has_data) { // Forbid any update that removes allowed values with actual data. $lost_keys = array_diff(array_keys($prior_field['settings']['allowed_values']), array_keys($field['settings']['allowed_values'])); if (_list_values_in_use($field, $lost_keys)) { throw new FieldUpdateForbiddenException(t('A list field (@field_name) with existing data cannot have its keys changed.', array('@field_name' => $field['field_name']))); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!modules!list!list.module/function/list_field_update_forbid/7.x