Skip to content

Instantly share code, notes, and snippets.

@enzolutions
Created February 16, 2014 16:35
Show Gist options
  • Save enzolutions/9036894 to your computer and use it in GitHub Desktop.
Save enzolutions/9036894 to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\Blog\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Template\TwigEnvironment;
class DefaultController extends ControllerBase implements ContainerInjectionInterface {
protected $twig;
/**
* helloAction
* @param string $name Get
* @return [type] [description]
*/
public function helloAction($name) {
return "Hello " . $name . "!";
}
public function __construct(TwigEnvironment $twig) {
$this->twig = $twig;
}
public static function create(ContainerInterface $container){
return new static(
$container->get('twig') );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment