Skip to content

Instantly share code, notes, and snippets.

@netlooker
Created April 26, 2018 13:31
Show Gist options
  • Save netlooker/4df6f9c71bf94c55526f8750752d84a6 to your computer and use it in GitHub Desktop.
Save netlooker/4df6f9c71bf94c55526f8750752d84a6 to your computer and use it in GitHub Desktop.
Index: modules/oe_theme_demo/oe_theme_demo.routing.yml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/oe_theme_demo/oe_theme_demo.routing.yml (date 1523027549000)
+++ modules/oe_theme_demo/oe_theme_demo.routing.yml (date 1523027549000)
@@ -0,0 +1,7 @@
+oe_theme_demo.example:
+ path: '/oe-theme-demo/example'
+ defaults:
+ _title: 'Example'
+ _controller: '\Drupal\oe_theme_demo\Controller\OpenEuropaThemeDemoController::build'
+ requirements:
+ _permission: 'access content'
Index: modules/oe_theme_demo/src/Controller/OpenEuropaThemeDemoController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/oe_theme_demo/src/Controller/OpenEuropaThemeDemoController.php (date 1524748928000)
+++ modules/oe_theme_demo/src/Controller/OpenEuropaThemeDemoController.php (date 1524748928000)
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\oe_theme_demo\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\Breadcrumb\Breadcrumb;
+use Drupal\Core\Link;
+
+/**
+ * Returns responses for OpenEuropa Theme Demo routes.
+ */
+class OpenEuropaThemeDemoController extends ControllerBase {
+
+ /**
+ * Builds the response.
+ */
+ public function build() {
+ $links = [
+ 'Home' => '<front>',
+ 'Test' => '<front>',
+ ];
+
+ $breadcrumb = new Breadcrumb();
+ foreach ($links as $title => $url) {
+ $breadcrumb->addLink(Link::createFromRoute($title, $url));
+
+ }
+
+ return $breadcrumb->toRenderable();
+ }
+
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment