You are here

function api_tokens_page_list in API Tokens 7

Renders token list page.

1 string reference to 'api_tokens_page_list'
api_tokens_menu in ./api_tokens.module
Implements hook_menu().

File

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

Code

function api_tokens_page_list() {

  // Retrieving module info.
  $module_list = system_rebuild_module_data();

  // Receiving all registered tokens.
  $tokens = api_tokens_collect_tokens();
  $tokens_info = array();

  // Grouping tokens by provider module.
  foreach ($tokens as $token) {
    $tokens_info[$token['module']][] = $token;
  }
  $rows = array();
  $i = 0;
  foreach ($tokens_info as $module => &$tokens) {
    $token = array_shift($tokens);
    $rows[$i] = array(
      $module => array(
        'data' => $module_list[$module]->info['name'],
        'rowspan' => count($tokens) + 1,
      ),
    );
    $rows[$i++] += api_tokens_page_build_row($token);
    foreach ($tokens as $token) {
      $rows[$i++] = api_tokens_page_build_row($token);
    }
  }
  $vars = array(
    'header' => array(
      t('Provider'),
      t('Token'),
      t('Synopsis'),
      t('Cache'),
      t('Expiration'),
      t('Description'),
    ),
    'rows' => $rows,
  );
  $content = theme('table', $vars) . '<div class="description"><sup>*</sup> - ' . t('Required parameter.') . '</div>';
  return $content;
}