You are here

function page_title_uuid_entity_uuid_save in Page Title 8.2

Same name and namespace in other branches
  1. 7.2 page_title.module \page_title_uuid_entity_uuid_save()

Implements hook_entity_uuid_save().

File

./page_title.module, line 789
Enhanced control over the page title (in the head tag).

Code

function page_title_uuid_entity_uuid_save(&$entity, $entity_type) {
  if (!empty($entity->page_title)) {

    // Insert page_title record for this entity.
    db_insert('page_title')
      ->fields(array(
      'type' => $entity_type,
      'id' => entity_id($entity_type, $entity),
      'page_title' => $entity->page_title,
    ))
      ->execute();
  }
  else {

    // Delete item so we get an auto-generated value basedo on settings.
    db_delete('page_title')
      ->condition('type', $entity_type)
      ->condition('id', entity_id($entity_type, $entity))
      ->execute();
  }
}