You are here

function flag_field_attach_save in Flag 7.3

Same name and namespace in other branches
  1. 7.2 flag.module \flag_field_attach_save()

Shared saving routine between flag_field_attach_insert/update().

See also

flag_field_attach_form()

2 calls to flag_field_attach_save()
flag_field_attach_insert in ./flag.module
Implements hook_field_attach_insert().
flag_field_attach_update in ./flag.module
Implements hook_field_attach_update().

File

./flag.module, line 889
The Flag module.

Code

function flag_field_attach_save($entity_type, $entity) {
  list($id) = entity_extract_ids($entity_type, $entity);

  // Get the flag values we stashed in the entity in flag_field_attach_submit().
  foreach ($entity->flag as $flag_name => $state) {
    flag($state ? 'flag' : 'unflag', $flag_name, $id);
  }
}