Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
- Unsupported
Not supported (i.e. abandoned), and no longer being developed. Learn more about dealing with unsupported (abandoned) projects - Obsolete
Use of this project is deprecated. - Module categories: Developer Tools
- Created by dmouse on , updated