You are here

function flag_lists_tokens in Flag Lists 7

Same name and namespace in other branches
  1. 8 flag_lists.tokens.inc \flag_lists_tokens()
  2. 7.3 flag_lists.module \flag_lists_tokens()
  3. 4.0.x flag_lists.tokens.inc \flag_lists_tokens()

Implements hook_tokens().

File

./flag_lists.module, line 1653
The Flag Lists module.

Code

function flag_lists_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $sanitize = !empty($options['sanitize']);
  $replacements = array();
  if ($type == 'flag_lists' && !empty($data['flag_lists'])) {
    $flag_list = $data['flag_lists'];
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'title':
          $replacements[$original] = $sanitize ? check_plain($flag_list->title) : $flag_lists->title;
          break;
        case 'term':
          $replacements[$original] = $sanitize ? check_plain(variable_get('flag_lists_name', t('list'))) : variable_get('flag_lists_name', t('list'));
          break;
      }
    }
  }
  return $replacements;
}