Last active
August 20, 2022 18:57
-
-
Save jmolivas/d29065493a91f16f35b2 to your computer and use it in GitHub Desktop.
Revisions
-
jmolivas revised this gist
May 8, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ .acme-hello-text { background-color: #dedede; } -
jmolivas revised this gist
May 7, 2014 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,12 @@ public function hello($name) { return [ '#theme' => 'hello_page', '#name' => $name, '#attached' => [ 'css' => [ drupal_get_path('module', 'acme') . '/assets/css/acme.css' ] ] ]; } } -
jmolivas revised this gist
May 7, 2014 . 2 changed files with 14 additions and 33 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,28 +3,9 @@ namespace Drupal\acme\Controller; use Drupal\Core\Controller\ControllerBase; class DefaultController extends ControllerBase { /** * hello @@ -33,19 +14,9 @@ public static function create(ContainerInterface $container) */ public function hello($name) { return [ '#theme' => 'hello_page', '#name' => $name ]; } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ <?php function acme_theme() { $theme['hello_page'] = [ 'variables' => ['name' => NULL], 'template' => 'hello' ]; return $theme; } -
jmolivas revised this gist
May 6, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,3 @@ <div class="acme-hello-text"> <h1>Hello {{ name }}!</h1> </div> -
jmolivas revised this gist
May 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public static function create(ContainerInterface $container) public function hello($name) { $template = $this->twig->loadTemplate( drupal_get_path('module', 'acme') . '/templates/hello.html.twig' ); -
jmolivas revised this gist
May 6, 2014 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ acme_hello: path: '/acme/hello/{name}' defaults: _content: '\Drupal\acme\Controller\DefaultController::hello' _title: 'acme Title' requirements: _permission: 'access content' -
jmolivas created this gist
May 6, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ <?php namespace Drupal\acme\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Template\TwigEnvironment; class DefaultController extends ControllerBase implements ContainerInjectionInterface { /** * @var Drupal\Core\Template\TwigEnvironment */ protected $twig; public function __construct(TwigEnvironment $twig) { $this->twig = $twig; } public static function create(ContainerInterface $container) { return new static( $container->get('twig') ); } /** * hello * @param string $name * @return string */ public function hello($name) { $template = $this->twig->loadTemplate( drupal_get_path('module', 'acme') . '/templates/hello.html.twig' ); $markup = [ '#markup' => $template->render([ 'name' => $name ]), '#attached' => [ 'css' => [ drupal_get_path('module', 'acme') . '/assets/css/acme.css' ] ] ]; return drupal_render($markup); } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ <h1>Hello {{ name }}!</h1>