function ThemingPageController::entryPage
Same name in other branches
- 3.x modules/theming_example/src/Controller/ThemingPageController.php \Drupal\theming_example\Controller\ThemingPageController::entryPage()
Initial landing page explaining the use of the module.
We create a render array and specify the theme to be used through the use of #theme_wrappers. With all output, we aim to leave the content as a render array just as long as possible, so that other modules (or the theme) can alter it.
See also
form_example_elements.inc
1 string reference to 'ThemingPageController::entryPage'
- theming_example.routing.yml in modules/
theming_example/ theming_example.routing.yml - modules/theming_example/theming_example.routing.yml
File
-
modules/
theming_example/ src/ Controller/ ThemingPageController.php, line 26
Class
- ThemingPageController
- Controller for theming example routes.
Namespace
Drupal\theming_example\ControllerCode
public function entryPage() {
$links = [];
$links[] = [
'#type' => 'link',
'#url' => Url::fromRoute('theming_example.list'),
'#title' => $this->t('Simple page with a list'),
];
$links[] = [
'#type' => 'link',
'#url' => Url::fromRoute('theming_example.form_select'),
'#title' => $this->t('Simple form 1'),
];
$links[] = [
'#type' => 'link',
'#url' => Url::fromRoute('theming_example.form_text'),
'#title' => $this->t('Simple form 2'),
];
$content = [
'#theme' => 'item_list',
'#theme_wrappers' => [
'theming_example_content_array',
],
'#items' => $links,
'#title' => $this->t('Some examples of pages and forms that are run through theme functions.'),
];
return $content;
}