Skip to content
This repository was archived by the owner on Jan 5, 2018. It is now read-only.

Commit 51dad17

Browse files
k4vBerdir
authored andcommitted
Issue #2656900 by k4v: Use admin theme for file usage
1 parent 96167af commit 51dad17

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

file_entity.services.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
file_entity.route_subscriber:
3+
class: Drupal\file_entity\Routing\RouteSubscriber
4+
tags:
5+
- { name: event_subscriber }

src/Routing/RouteSubscriber.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Contains \Drupal\file_entity\Routing\RouteSubscriber.
6+
*/
7+
8+
namespace Drupal\file_entity\Routing;
9+
10+
use Drupal\Core\Routing\RouteSubscriberBase;
11+
use Symfony\Component\Routing\RouteCollection;
12+
13+
/**
14+
* Listens to the dynamic route events.
15+
*/
16+
class RouteSubscriber extends RouteSubscriberBase {
17+
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function alterRoutes(RouteCollection $collection) {
22+
// The usage view should be shown in the admin theme.
23+
if ($route = $collection->get('view.file_entity_files.usage')) {
24+
$route->setOption('_admin_route', TRUE);
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)