annotate core/modules/block/src/Theme/AdminDemoNegotiator.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\block\Theme;
Chris@0 4
Chris@0 5 use Drupal\Core\Routing\RouteMatchInterface;
Chris@0 6 use Drupal\Core\Theme\ThemeNegotiatorInterface;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Negotiates the theme for the block admin demo page via the URL.
Chris@0 10 */
Chris@0 11 class AdminDemoNegotiator implements ThemeNegotiatorInterface {
Chris@0 12
Chris@0 13 /**
Chris@0 14 * {@inheritdoc}
Chris@0 15 */
Chris@0 16 public function applies(RouteMatchInterface $route_match) {
Chris@0 17 return $route_match->getRouteName() == 'block.admin_demo';
Chris@0 18 }
Chris@0 19
Chris@0 20 /**
Chris@0 21 * {@inheritdoc}
Chris@0 22 */
Chris@0 23 public function determineActiveTheme(RouteMatchInterface $route_match) {
Chris@0 24 // We return exactly what was passed in, to guarantee that the page will
Chris@0 25 // always be displayed using the theme whose blocks are being configured.
Chris@0 26 return $route_match->getParameter('theme');
Chris@0 27 }
Chris@0 28
Chris@0 29 }