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

8.0.x
Alex Pott 2014-08-15 23:54:07 +01:00
parent 28ef6b28c3
commit 3254a1a67a
4 changed files with 29 additions and 5 deletions

View File

@ -50,7 +50,7 @@ class ParamConverterSubscriber implements EventSubscriberInterface {
*/
static function getSubscribedEvents() {
// Run after \Drupal\system\EventSubscriber\AdminRouteSubscriber.
$events[RoutingEvents::ALTER][] = array('onRoutingRouteAlterSetParameterConverters', -210);
$events[RoutingEvents::ALTER][] = array('onRoutingRouteAlterSetParameterConverters', -220);
return $events;
}
}

View File

@ -168,7 +168,9 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
*/
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;
}

View File

@ -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'

View File

@ -45,6 +45,13 @@ class MenuLinkContentUITest extends ContentTranslationUITest {
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 @@ class MenuLinkContentUITest extends ContentTranslationUITest {
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.');
}
}