function hook_field_presave


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
cle7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
elmsmedia7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
icor7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
meedjum_blog7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)
mooc7 field.api.php hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items)

Define custom presave behavior for this module's field types.

Make changes or additions to field values by altering the $items parameter by reference. There is no return value.


$entity_type: The type of $entity.

$entity: The entity for the operation.

$field: The field structure for the operation.

$instance: The instance structure for $field on $entity's bundle.

$langcode: The language associated with $items.

$items: $entity->{$field['field_name']}[$langcode], or an empty array if unset.

Related topics

8 functions implement hook_field_presave()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

date_field_presave in sites/all/modules/ulmus/date/
Implements hook_field_insert().
entityreference_field_presave in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_field_presave().
field_hidden_field_presave in sites/all/modules/ulmus/field_hidden/field_hidden.module
Allows for item value transformations right before the item value (from a submitted for) is being saved in the database.
file_field_presave in modules/file/
Implements hook_field_presave().
image_field_presave in modules/image/
Implements hook_field_presave().

... See full list

3 invocations of hook_field_presave()
EntityAPIController::save in sites/all/modules/ulmus/entity/includes/
Implements EntityAPIControllerInterface.
field_attach_presave in modules/field/
Perform necessary operations just before fields data get saved.
user_save in modules/user/user.module
Save changes to a user account or add a new user.


modules/field/field.api.php, line 428


function hook_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  if ($field['type'] == 'number_decimal') {
    // Let PHP round the value to ensure consistent behavior across storage
    // backends.
    foreach ($items as $delta => $item) {
      if (isset($item['value'])) {
        $items[$delta]['value'] = round($item['value'], $field['settings']['scale']);