devel_wizard-2.x-dev/templates/spell/controller/class.php.twig
templates/spell/controller/class.php.twig
{%
include '@devel_wizard/php/devel_wizard.php.file.header.php.twig'
with {
'namespace': controller.classNamespace,
}
%}
use Drupal\Core\Entity\EntityTypeManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class {{ controller.className }} extends ControllerBase {
/**
* {@inheritdoc}
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public static function create(ContainerInterface $container): static {
// @phpstan-ignore-next-line
return new static(
$container->get('entity_type.manager'),
);
}
public function __construct(
EntityTypeManager $entityTypeManager,
) {
$this->entityTypeManager = $entityTypeManager;
}
public function pageTitle(): string|\Stringable {
return $this->t('My page title 01');
}
public function pageBody() {
$build = [
'content' => [
'#type' => 'markup',
'#markup' => '@todo This is the page content.',
],
];
return $build;
}
}
