You are here

function api_tokens_param_info in API Tokens 7

Returns parameters info of the token process function.

2 calls to api_tokens_param_info()
api_tokens_page_format_synopsis in includes/api_tokens.admin.inc
Renders synopsis cell.
api_tokens_render in ./api_tokens.module
Processes API tokens.

File

./api_tokens.module, line 103
The API Tokens module

Code

function api_tokens_param_info($token, $full = FALSE) {
  $tokens =& drupal_static('api_tokens_collect_tokens', FALSE);
  $reflection = new ReflectionFunction($tokens[$token]['handler']);

  // Number of required parameters only.
  $data = $reflection
    ->getNumberOfRequiredParameters();
  $tokens[$token]['params'] = $data;

  // Number of required parameters and parameter list.
  if ($full) {
    $params = array();
    $ref_params = $reflection
      ->getParameters();
    foreach ($ref_params as $param) {
      $params[] = $param->name;
    }
    $data = array(
      'count' => $data,
      'params' => $params,
    );
  }
  return $data;
}