Created
February 16, 2014 16:59
-
-
Save dmouse/9037206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Drupal\badcamp\Controller; | |
| use Drupal\Core\Controller\ControllerBase; | |
| use Symfony\Component\DependencyInjection\ContainerInterface; | |
| use Drupal\Core\DependencyInjection\ContainerInjectionInterface; | |
| use Drupal\ExtraModule\Annotation\Permission; | |
| use Drupal\Core\Template\TwigEnvironment; | |
| class DefaultController extends ControllerBase implements ContainerInjectionInterface { | |
| /** | |
| * @var \TwigEnvironment | |
| */ | |
| protected $twig; | |
| public function __construct(TwigEnvironment $twig) { | |
| $this->twig = $twig; | |
| } | |
| public static function create(ContainerInterface $container){ | |
| return new static( | |
| $container->get('twig') | |
| ); | |
| } | |
| /** | |
| * helloAction | |
| * @param string $name Get | |
| * @return [type] [description] | |
| * | |
| * @Permission("access content") | |
| */ | |
| public function helloAction($name) { | |
| $template = $this->twig->loadTemplate('badcamp::hello.html.twig'); | |
| return $template->render(array( | |
| 'name' => $name | |
| )); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment