You are here

function pathauto_entity_state_save in Pathauto 7

Save the pathauto state for an entity.

Parameters

string $entity_type: The entity type.

object $entity: The entity object.

bool $pathauto_state: A value that evaluates to TRUE means that Pathauto should keep controlling this entity's path in the future. A value that evaluates to FALSE means that Pathauto should not manage the entity's path.

2 calls to pathauto_entity_state_save()
pathauto_entity_insert in ./pathauto.module
Implements hook_entity_insert().
pathauto_entity_update in ./pathauto.module
Implements hook_entity_update().

File

./pathauto.module, line 482
Main file for the Pathauto module, which automatically generates aliases for content.

Code

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