TestingExampleController.php in Examples for Developers 3.x
File
modules/testing_example/src/Controller/TestingExampleController.php
View source
<?php
namespace Drupal\testing_example\Controller;
use Drupal\examples\Utility\DescriptionTemplateTrait;
class TestingExampleController {
use DescriptionTemplateTrait;
protected function getModuleName() {
return 'testing_example';
}
public function simpletestDescription() {
$template_file = drupal_get_path('module', 'testing_example') . '/templates/simpletest.description.html.twig';
$build = [
'description' => [
'#type' => 'inline_template',
'#template' => file_get_contents($template_file),
],
];
return $build;
}
}