Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Extra Module Add conventions to Twig engine and annotations to Drupal controllers, allowing to create more concise controllers and templates.

This modules is an implementation of http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle

Usage

  • Download and enable module
  • Use your awesome powers

@Permission Annotation

class DefaultController extends ControllerBase{
  //...
  /**
   * helloAction
   * @param  string $name 
   *
   * @Permission("access content")
   */
  public function helloAction($name) {
    return "Hello " . $name . "!";
  }
  //...
}

Call twig template like Symfony

{# hello.html.twig #}

{% extends "module_name::base.html.twig" %}

{% block hello_wrapper %}
  Hellos {{name}}
{% endblock %}
// Controller
class DefaultController extends ControllerBase implements ContainerInjectionInterface {
  //...
  public function helloAction($name) {
    $template = $this->twig->loadTemplate('module_name::hello.html.twig');

    return $template->render(array(
      'name' => $name
    ));
  }
  //...
}

Roadmap

  • Template annotation

Project information