You are here

function entity2text_token_info_alter in Entity To Text 7

Implements hook_token_info_alter().

Provide a token for each View Mode for each Entity Type.

File

./entity2text.module, line 7

Code

function entity2text_token_info_alter(&$data) {
  $entity_infos = entity_get_info();
  foreach ($entity_infos as $enity_type => $entity_info) {
    if (isset($data['tokens'][$enity_type])) {
      foreach ($entity_info['view modes'] as $view_name => $view_mode) {
        $data['tokens'][$enity_type]['textexport-' . $view_name] = array(
          'name' => 'Text Export: ' . $view_mode['label'],
          'description' => "Exports the enity text using View Mode " . $view_mode['label'],
          'type' => 'text',
        );
      }
    }
  }
}