You are here

function course_token_info in Course 8.3

Same name and namespace in other branches
  1. 8.2 course.module \course_token_info()
  2. 7.2 course.module \course_token_info()
  3. 7 course.module \course_token_info()

Implements hook_token_info().

File

./course.module, line 588
course.module Core functionality for Courses.

Code

function course_token_info() {
  $info = array();
  module_load_install('course');
  $schema = course_schema();

  // Typess
  $info['types']['course'] = array(
    'name' => t('Course'),
    'description' => t('Course'),
    'needs-data' => 'node',
  );
  $info['types']['course-report'] = array(
    'name' => t('Course report'),
    'description' => t('Course report entry'),
  );

  // Tokens
  foreach ($schema['course_node']['fields'] as $key => $value) {
    $info['tokens']['course'][$key] = array(
      'name' => $value['description'],
      'description' => $value['description'],
    );
  }
  $info['tokens']['node']['course'] = array(
    'name' => t('Course'),
    'description' => t('The course of the node.'),
    'type' => 'course',
  );
  return $info;
}