protected function ArgumentPluginBase::getTokenHelp in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::getTokenHelp()
Provide token help information for the argument.
Return value
array A render array.
1 call to ArgumentPluginBase::getTokenHelp()
- ArgumentPluginBase::buildOptionsForm in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Provide a form to edit options for this plugin.
File
- core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php, line 378
Class
- ArgumentPluginBase
- Base class for argument (contextual filter) handler plugins.
Namespace
Drupal\views\Plugin\views\argumentCode
protected function getTokenHelp() {
$output = [];
foreach ($this->view->display_handler
->getHandlers('argument') as $arg => $handler) {
/** @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $handler */
$options[(string) t('Arguments')]["{{ arguments.{$arg} }}"] = $this
->t('@argument title', [
'@argument' => $handler
->adminLabel(),
]);
$options[(string) t('Arguments')]["{{ raw_arguments.{$arg} }}"] = $this
->t('@argument input', [
'@argument' => $handler
->adminLabel(),
]);
}
// We have some options, so make a list.
if (!empty($options)) {
$output[] = [
'#markup' => '<p>' . $this
->t("The following replacement tokens are available for this argument.") . '</p>',
];
foreach (array_keys($options) as $type) {
if (!empty($options[$type])) {
$items = [];
foreach ($options[$type] as $key => $value) {
$items[] = $key . ' == ' . $value;
}
$item_list = [
'#theme' => 'item_list',
'#items' => $items,
];
$output[] = $item_list;
}
}
}
return $output;
}