function profanity_entity_prepare_view in Profanity 7
Implements hook_entity_load().
File
- ./
profanity.module, line 258 - Main {profanity} file.
Code
function profanity_entity_prepare_view($entities, $entity_type, $langcode) {
// If title filtering is enabled check the type.
if (variable_get('profanity_protect_the_titles', 0) && in_array($entity_type, variable_get('profanity_title_entities', array()), TRUE)) {
$entity_info = entity_get_info();
foreach ($entities as $entity_id => $entity) {
foreach (variable_get('profanity_title_lists', array()) as $list_name) {
if (empty($entity_info[$entity_type]['entity keys']['label'])) {
break;
}
$title_property = $entity_info[$entity_type]['entity keys']['label'];
$entity->{'original_' . $title_property} = $entity->{$title_property};
$entity->{$title_property} = profanity_list_execute($list_name, $entity->{$title_property});
}
}
}
}