function DescriptionTemplateTrait::description
Same name in other branches
- 8.x-1.x src/Utility/DescriptionTemplateTrait.php \Drupal\examples\Utility\DescriptionTemplateTrait::description()
- 4.0.x src/Utility/DescriptionTemplateTrait.php \Drupal\examples\Utility\DescriptionTemplateTrait::description()
Generate a render array with our templated content.
Return value
array A render array.
2 calls to DescriptionTemplateTrait::description()
- MenuExampleController::basicInstructions in modules/
menu_example/ src/ Controller/ MenuExampleController.php - Page callback for the simplest introduction menu entry.
- RobotListBuilder::render in modules/
config_entity_example/ src/ Controller/ RobotListBuilder.php - Adds some descriptive text to our entity list.
File
-
src/
Utility/ DescriptionTemplateTrait.php, line 34
Class
- DescriptionTemplateTrait
- Trait to implement a "drop-in" template for Example's controllers.
Namespace
Drupal\examples\UtilityCode
public function description() {
$template_path = $this->getDescriptionTemplatePath();
$template = file_get_contents($template_path);
$build = [
'description' => [
'#type' => 'inline_template',
'#template' => $template,
'#context' => $this->getDescriptionVariables(),
],
];
return $build;
}