Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Drupal\example\Controller;
- use Drupal\Core\Controller\ControllerBase;
- use Symfony\Component\DependencyInjection\ContainerInterface;
- class ExampleController extends ControllerBase
- {
- protected $example_service;
- public function __construct($example_service)
- {
- $this->example_service = $example_service;
- }
- public static function create(ContainerInterface $container)
- {
- return new static(
- $container->get('example.example_service')
- );
- }
- public function homepage() {
- return array(
- '#markup' => t(
- 'Hello @value!',
- array('@value' => $this->example_service->getValue())
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement