You are here

function profanity_entity_property_info_alter in Profanity 7

Implements hook_entity_property_info_alter().

File

./profanity.module, line 233
Main {profanity} file.

Code

function profanity_entity_property_info_alter(&$info) {
  $lists = variable_get('profanity_supply_entity_properties_lists', array());
  if (variable_get('profanity_supply_entity_properties', 0) && !empty($lists)) {
    $entity_info = entity_get_info();
    foreach ($entity_info as $entity_type => $entity) {
      if (empty($entity['entity keys']['label'])) {
        continue;
      }
      $title_property = $entity['entity keys']['label'];
      $info[$entity_type]['properties']["profanity_{$title_property}"] = array(
        'label' => t('@label profanity filtered', array(
          '@label' => ucfirst($title_property),
        )),
        'description' => t('The @label property passed through profanity filters.', array(
          '@label' => $title_property,
        )),
        'type' => 'text',
        'computed' => TRUE,
        'getter callback' => 'profanity_entity_property_getter',
      );
    }
  }
}