Commit 3254a1a6 authored by alexpott's avatar alexpott

Issue #2310475 by Gábor Hojtsy | dawehner: Fixed Admin theme for translation...

Issue #2310475 by Gábor Hojtsy | dawehner: Fixed Admin theme for translation tabs just works for nodes.
parent 28ef6b28
......@@ -50,7 +50,7 @@ public function onRoutingRouteAlterSetParameterConverters(RouteBuildEvent $event
*/
static function getSubscribedEvents() {
// Run after \Drupal\system\EventSubscriber\AdminRouteSubscriber.
$events[RoutingEvents::ALTER][] = array('onRoutingRouteAlterSetParameterConverters', -210);
$events[RoutingEvents::ALTER][] = array('onRoutingRouteAlterSetParameterConverters', -220);
return $events;
}
}
......@@ -168,7 +168,9 @@ protected function alterRoutes(RouteCollection $collection) {
*/
public static function getSubscribedEvents() {
$events = parent::getSubscribedEvents();
$events[RoutingEvents::ALTER] = array('onAlterRoutes', -100);
// Should run after AdminRouteSubscriber so the routes can inherit admin
// status of the edit routes on entities. Therefore priority -210.
$events[RoutingEvents::ALTER] = array('onAlterRoutes', -210);
return $events;
}
......
......@@ -11,9 +11,6 @@ entity.menu_link_content.canonical:
defaults:
_entity_form: 'menu_link_content.default'
_title: 'Edit menu link'
options:
# @todo Remove once https://www.drupal.org/node/2310475 is in.
_admin_route: TRUE
requirements:
_entity_access: 'menu_link_content.update'
......
......@@ -45,6 +45,13 @@ protected function getTranslatorPermissions() {
return array_merge(parent::getTranslatorPermissions(), array('administer menu'));
}
/**
* {@inheritdoc}
*/
protected function getAdministratorPermissions() {
return array_merge(parent::getAdministratorPermissions(), array('administer themes', 'view the administration theme'));
}
/**
* {@inheritdoc}
*/
......@@ -56,4 +63,22 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) {
return parent::createEntity($values, $langcode, $bundle_name);
}
/**
* Tests that translation page inherits admin status of edit page.
*/
function testTranslationLinkTheme() {
$this->drupalLogin($this->administrator);
$entityId = $this->createEntity(array(), 'en');
// Set up Seven as the admin theme to test.
$this->container->get('theme_handler')->enable(array('seven'));
$edit = array();
$edit['admin_theme'] = 'seven';
$this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
$this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit');
$this->assertRaw('"theme":"seven"', 'Edit uses admin theme.');
$this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit/translations');
$this->assertRaw('"theme":"seven"', 'Translation uses admin theme as well.');
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment