function maxlength_update_7301 in Maxlength 7.3
Implements hook_update_N().
migrate fieldapi fields
File
- ./
maxlength.install, line 53 - Install, update and uninstall functions for the Maxlength module.
Code
function maxlength_update_7301() {
$ret = array();
// The 7.x-2.x seems to support only global settings for fields not per instance
// so setup the maxlength for each instance of the field.
foreach (field_read_fields() as $field) {
if (!empty($field['settings']['max_length'])) {
$maxlength = $field['settings']['max_length'];
$instances = field_read_instances(array(
'entity_type' => $entity_type,
'field_name' => $field_name,
'bundle' => $bundle,
));
foreach ($instances as $instance) {
$instance['widget']['settings']['maxlength_js'] = $maxlength;
}
}
}
return $ret;
}