You are here

private function flag_flag::flagging_update in Flag 7.3

Update a Flagging.

Parameters

$flagging: The flagging entity that is being updated.

$entity_id: The entity ID of entity the flagging is on.

$account: The account performing the action.

1 call to flag_flag::flagging_update()
flag_flag::flag in includes/flag/flag_flag.inc
Flags, or unflags, an item.

File

includes/flag/flag_flag.inc, line 863
Contains the flag_flag class. Flag type classes use an object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

private function flagging_update($flagging, $entity_id, $account) {

  // Invoke presave hooks.
  // This is technically still a presave, even though the {flagging} table
  // itself is not changed.
  field_attach_presave('flagging', $flagging);

  // Invoke hook_entity_presave().
  module_invoke_all('entity_presave', $flagging, 'flagging');

  // This check exists solely to preserve previous behaviour with re-flagging.
  // TODO: consider removing it.
  if (!empty($flagging->given_as_parameter)) {
    field_attach_update('flagging', $flagging);

    // Update the cache.
    entity_get_controller('flagging')
      ->resetCache();

    // Invoke hook_entity_update().
    // Since there are no fields on the {flagging} table that can be
    // meaningfully changed, we don't perform an update on it. However, this
    // technically still counts as updating the flagging entity, since we update
    // its fields.
    module_invoke_all('entity_update', $flagging, 'flagging');
  }
}