You are here

function protected_node_token_values in Protected Node 6

Implementation of hook_token_values().

File

./protected_node.module, line 766

Code

function protected_node_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node' && $object) {
    if (empty($object->protected_node_is_protected)) {
      $tokens['node-is-protected'] = t('no');
      $tokens['node-password'] = '';
      $tokens['node-protected-title'] = '';
      $tokens['node-password-hint'] = '';
    }
    else {
      $tokens['node-is-protected'] = t('yes');
      $tokens['node-password'] = empty($object->protected_node_clear_passwd) ? '' : $object->protected_node_clear_passwd;
      $tokens['node-protected-title'] = empty($object->protected_node_show_title) ? t('no') : t('yes');
      $tokens['node-password-hint'] = $object->protected_node_hint;
    }
    return $tokens;
  }
}