You are here

function api_tokens_page_format_synopsis in API Tokens 7

Renders synopsis cell.

1 call to api_tokens_page_format_synopsis()
api_tokens_page_build_row in includes/api_tokens.admin.inc
Builds token list table row.

File

includes/api_tokens.admin.inc, line 12
Administrative interface for the API Tokens module.

Code

function api_tokens_page_format_synopsis($token) {

  // Verifying token process function.
  if (api_tokens_prepare_handler($token['key'])) {

    // Collecting full handler params info.
    $param_info = api_tokens_param_info($token['key'], TRUE);
    $content = '<code>[api:' . $token['key'] . '/]</code>';
    foreach ($param_info['params'] as $i => $param) {
      $param_info['params'][$i] = '<strong><em>' . $param_info['params'][$i] . '</em></strong>';
      if ($i < $param_info['count']) {
        $param_info['params'][$i] .= '<sup>*</sup>';
      }
    }
    $param_info = implode(', ', $param_info['params']);
    $content = $param_info ? str_replace('/]', '[' . $param_info . ']/]', $content) : $content;
  }
  else {
    $content = '<em>' . t('Token handler not found') . '</em>';
  }
  return $content;
}