You are here

function course_token_info in Course 7.2

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

Implements hook_token_info().

File

./course.module, line 1812
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'),
  );
  $info['tokens']['node']['course'] = array(
    'name' => t('Course'),
    'description' => t('The course of the node.'),
    'type' => 'course',
  );
  foreach ($schema['course_report']['fields'] as $key => $value) {
    $info['tokens']['course-report'][$key] = array(
      'name' => $value['description'],
      'description' => $value['description'],
    );
  }
  $info['tokens']['course-report']['date_completed']['type'] = 'date';
  $info['tokens']['course-report']['updated']['type'] = 'date';
  $info['tokens']['course-report']['data']['type'] = 'array';
  return $info;
}