function auto_entitylabel_exit in Automatic Entity Label 7
Implements hook_exit().
See also
auto_entitylabel_entity_insert()
File
- ./
auto_entitylabel.module, line 172 - Allows hiding of entity label fields and automatic label creation.
Code
function auto_entitylabel_exit($destination = NULL) {
$entity_list =& drupal_static('auto_entitylabel_entity_insert', array());
// Loop through the entity types and then individual entity IDs.
foreach ($entity_list as $entity_type => $entity_ids) {
foreach ($entity_ids as $entity_id) {
$entity = entity_load_single($entity_type, $entity_id);
$settings = _auto_entitylabel_get_settings($entity, $entity_type);
if ($entity) {
// Store the old label.
$old_label = $entity->{$settings['title']};
// Update the entity label.
auto_entitylabel_set_title($entity, $entity_type);
// Save it only if the title has changed.
if ($entity->{$settings['title']} != $old_label) {
entity_save($entity_type, $entity);
}
}
}
}
}