public function ApiTokenController::adminOverview in API Tokens 8
Same name and namespace in other branches
- 8.2 src/Controller/ApiTokenController.php \Drupal\api_tokens\Controller\ApiTokenController::adminOverview()
Displays the API tokens overview page.
Return value
array A renderable array.
1 string reference to 'ApiTokenController::adminOverview'
File
- src/
Controller/ ApiTokenController.php, line 46
Class
- ApiTokenController
- Controller routines for API tokens routes.
Namespace
Drupal\api_tokens\ControllerCode
public function adminOverview() {
$build['table'] = [
'#type' => 'table',
'#header' => [
$this
->t('Token'),
$this
->t('Synopsis'),
$this
->t('Provider'),
],
'#empty' => $this
->t('There are no API tokens registered.'),
];
foreach ($this->apiTokenManager
->getSortedDefinitions() as $id => $definition) {
$row =& $build['table'][$id];
$row['token'] = [
'#type' => 'item',
'#title' => $definition['label'],
'#description' => $definition['description'],
'#description_display' => 'after',
];
$row['synopsis'] = $this
->buildSynopsis($id);
$row['provider'] = [
'#type' => 'item',
'#title' => $definition['category'],
'#description' => $this
->t('Machine name: @provider', [
'@provider' => $definition['provider'],
]),
'#description_display' => 'after',
];
}
return $build;
}