You are here

function pathauto_persist_entity_state_save in Pathauto Persistent State 7

Same name and namespace in other branches
  1. 6 pathauto_persist.module \pathauto_persist_entity_state_save()

Save the pathauto state for an entity.

Parameters

$entity_type: An entity type.

$entity: The entity object.

$pathauto_state: A boolean flag if TRUE means that Pathauto should keep controlling this entity's path in the future. A FALSE value means Pathauto should stay out.

2 calls to pathauto_persist_entity_state_save()
pathauto_persist_entity_insert in ./pathauto_persist.module
Implements hook_entity_insert().
pathauto_persist_entity_update in ./pathauto_persist.module
Implements hook_entity_update().

File

./pathauto_persist.module, line 99

Code

function pathauto_persist_entity_state_save($entity_type, $entity, $pathauto_state) {
  list($entity_id) = entity_extract_ids($entity_type, $entity);
  db_merge('pathauto_persist')
    ->key(array(
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
  ))
    ->fields(array(
    'pathauto' => $pathauto_state ? 1 : 0,
  ))
    ->execute();
  drupal_static_reset('pathauto_persist_entity_load');
}