This repository has been archived on 2025-09-29. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
docker-examples/web/modules/custom/example/src/Controller/ExamplePageController.php
2023-04-21 12:48:26 +01:00

32 lines
715 B
PHP

<?php
declare(strict_types=1);
namespace Drupal\example\Controller;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
final class ExamplePageController {
use StringTranslationTrait;
public function __construct(
private LoggerChannelFactoryInterface $logger
) {}
/**
* @return array<string,mixed>
*/
public function __invoke(): array {
$this->logger->get('example')->info('Example page viewed.');
return [
'#markup' => $this->t(
'This is an example page from the <a href="@url">Drupal Module Template</a>.',
['@url' => 'https://github.com/opdavies/drupal-module-template']
),
];
}
}