Commit ed38d9eb authored by webchick's avatar webchick

Issue #2194823 by znerol, YesCT, dawehner: Ensure that all content/page routes have an _title.

parent f6324f38
......@@ -619,6 +619,17 @@ protected function resetSystem() {
$this->themeRegistryRebuild();
}
/**
* {@inheritdoc}
*/
public function getName($theme) {
$themes = $this->listInfo();
if (!isset($themes[$theme])) {
throw new \InvalidArgumentException(String::format('Requested the name of a non-existing theme @theme', array('@theme' => $theme)));
}
return String::checkPlain($themes[$theme]->info['name']);
}
/**
* Wraps system_list_reset().
*/
......
......@@ -120,4 +120,15 @@ public function rebuildThemeData();
*/
public function getBaseThemes(array $themes, $theme);
/**
* Gets the human readable name of a given theme.
*
* @param string $theme
* The machine name of the theme which title should be shown.
*
* @return string
* Returns the human readable name of the theme.
*/
public function getName($theme);
}
......@@ -10,6 +10,7 @@ action.admin_add:
path: '/admin/config/system/actions/add/{action_id}'
defaults:
_entity_form: 'action.add'
_title: 'Add'
requirements:
_permission: 'administer actions'
......@@ -17,6 +18,7 @@ action.admin_configure:
path: '/admin/config/system/actions/configure/{action}'
defaults:
_entity_form: 'action.edit'
_title: 'Edit'
requirements:
_permission: 'administer actions'
......@@ -24,6 +26,7 @@ action.delete:
path: '/admin/config/system/actions/configure/{action}/delete'
defaults:
_entity_form: 'action.delete'
_title: 'Delete'
requirements:
_permission: 'administer actions'
......@@ -2,6 +2,7 @@ block.admin_demo:
path: '/admin/structure/block/demo/{theme}'
defaults:
_content: '\Drupal\block\Controller\BlockController::demo'
_title_callback: 'theme_handler:getName'
requirements:
_access_theme: 'TRUE'
_permission: 'administer blocks'
......@@ -20,6 +21,7 @@ block.admin_edit:
path: '/admin/structure/block/manage/{block}'
defaults:
_entity_form: 'block.default'
_title: 'Configure block'
requirements:
_entity_access: 'block.update'
......
......@@ -2,6 +2,7 @@ custom_block.type_list:
path: '/admin/structure/block/custom-blocks/types'
defaults:
_entity_list: 'custom_block_type'
_title: 'Edit'
requirements:
_permission: 'administer blocks'
......@@ -48,6 +49,7 @@ custom_block.delete:
path: '/block/{custom_block}/delete'
defaults:
_entity_form: 'custom_block.delete'
_title: 'Delete'
options:
_admin_route: TRUE
requirements:
......@@ -57,6 +59,7 @@ custom_block.type_add:
path: '/admin/structure/block/custom-blocks/types/add'
defaults:
_entity_form: 'custom_block_type.add'
_title: 'Add'
requirements:
_permission: 'administer blocks'
......@@ -64,6 +67,7 @@ custom_block.type_edit:
path: '/admin/structure/block/custom-blocks/manage/{custom_block_type}'
defaults:
_entity_form: 'custom_block_type.edit'
_title: 'Edit'
requirements:
_entity_access: 'custom_block_type.update'
......
......@@ -9,6 +9,9 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Extension\ThemeHandler;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
......@@ -16,6 +19,32 @@
*/
class BlockController extends ControllerBase {
/**
* The theme handler.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* Constructs a new BlockController instance.
*
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
*/
public function __construct(ThemeHandlerInterface $theme_handler) {
$this->themeHandler = $theme_handler;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('theme_handler')
);
}
/**
* Returns a block theme demo page.
*
......@@ -26,9 +55,8 @@ class BlockController extends ControllerBase {
* A render array containing the CSS and title for the block region demo.
*/
public function demo($theme) {
$themes = list_themes();
return array(
'#title' => String::checkPlain($themes[$theme]->info['name']),
'#title' => String::checkPlain($this->themeHandler->getName($theme)),
'#attached' => array(
'js' => array(
array(
......
......@@ -19,6 +19,7 @@ editor.image_dialog:
path: '/editor/dialog/image/{filter_format}'
defaults:
_form: '\Drupal\editor\Form\EditorImageDialog'
_title: 'Upload image'
requirements:
_entity_access: 'filter_format.use'
......@@ -26,5 +27,6 @@ editor.link_dialog:
path: '/editor/dialog/link/{filter_format}'
defaults:
_form: '\Drupal\editor\Form\EditorLinkDialog'
_title: 'Add link'
requirements:
_entity_access: 'filter_format.use'
......@@ -35,6 +35,7 @@ filter.format_edit:
path: '/admin/config/content/formats/manage/{filter_format}'
defaults:
_entity_form: filter_format.edit
_title_callback: '\Drupal\filter\Controller\FilterController::getLabel'
requirements:
_entity_access: 'filter_format.update'
......
......@@ -37,4 +37,17 @@ function filterTips(FilterFormatInterface $filter_format = NULL) {
return $build;
}
/**
* Gets the label of a filter format.
*
* @param \Drupal\filter\FilterFormatInterface $filter_format
* The filter format.
*
* @return string
* The label of the filter format.
*/
public function getLabel(FilterFormatInterface $filter_format) {
return $filter_format->label();
}
}
......@@ -2,6 +2,7 @@ language.negotiation_url:
path: '/admin/config/regional/language/detection/url'
defaults:
_form: 'Drupal\language\Form\NegotiationUrlForm'
_title: 'Configure URL language negotiation'
requirements:
_permission: 'administer languages'
......@@ -9,6 +10,7 @@ language.negotiation_session:
path: '/admin/config/regional/language/detection/session'
defaults:
_form: 'Drupal\language\Form\NegotiationSessionForm'
_title: 'Configure session language negotiation'
requirements:
_permission: 'administer languages'
......@@ -16,6 +18,7 @@ language.negotiation_selected:
path: '/admin/config/regional/language/detection/selected'
defaults:
_form: 'Drupal\language\Form\NegotiationSelectedForm'
_title: 'Configure selection language negotiation'
requirements:
_permission: 'administer languages'
......@@ -71,6 +74,7 @@ language.negotiation_browser_delete:
path: '/admin/config/regional/language/detection/browser/delete/{browser_langcode}'
defaults:
_form: '\Drupal\language\Form\NegotiationBrowserDeleteForm'
_title: 'Delete'
requirements:
_permission: 'administer languages'
......
......@@ -56,6 +56,7 @@ node.delete_confirm:
path: '/node/{node}/delete'
defaults:
_entity_form: 'node.delete'
_title: 'Delete'
requirements:
_entity_access: 'node.delete'
options:
......
......@@ -57,6 +57,7 @@ search.delete:
path: '/admin/config/search/pages/manage/{search_page}/delete'
defaults:
_entity_form: 'search_page.delete'
_title: 'Delete'
requirements:
_entity_access: 'search_page.delete'
......
......@@ -50,6 +50,7 @@ shortcut.link_add:
path: '/admin/config/user-interface/shortcut/manage/{shortcut_set}/add-link'
defaults:
_content: '\Drupal\shortcut\Controller\ShortcutController::addForm'
_title: 'Add link'
requirements:
_entity_create_access: 'shortcut:{shortcut_set}'
......@@ -57,6 +58,7 @@ shortcut.link_edit:
path: '/admin/config/user-interface/shortcut/link/{shortcut}'
defaults:
_entity_form: 'shortcut.default'
_title: 'Edit'
requirements:
_entity_access: 'shortcut.update'
......@@ -64,6 +66,7 @@ shortcut.link_delete:
path: '/admin/config/user-interface/shortcut/link/{shortcut}/delete'
defaults:
_entity_form: 'shortcut.delete'
_title: 'Delete'
requirements:
_entity_access: 'shortcut.delete'
......
......@@ -138,7 +138,7 @@ function testBreadCrumbs() {
// @todo Remove this part once we have a _title_callback, see
// https://drupal.org/node/2076085.
$trail += array(
"admin/config/content/formats/manage/$format_id" => Unicode::ucfirst(Unicode::strtolower($format->name)),
"admin/config/content/formats/manage/$format_id" => $format->label(),
);
$this->assertBreadcrumb("admin/config/content/formats/manage/$format_id/disable", $trail);
......
......@@ -341,6 +341,7 @@ system.theme_settings_theme:
path: '/admin/appearance/settings/{theme}'
defaults:
_form: '\Drupal\system\Form\ThemeSettingsForm'
_title_callback: 'theme_handler:getName'
requirements:
_permission: 'administer themes'
......
......@@ -62,6 +62,7 @@ taxonomy.vocabulary_reset:
path: '/admin/structure/taxonomy/manage/{taxonomy_vocabulary}/reset'
defaults:
_entity_form: 'taxonomy_vocabulary.reset'
_title: 'Reset'
requirements:
_permission: 'administer taxonomy'
......
......@@ -103,6 +103,7 @@ user.role_edit:
path: '/admin/people/roles/manage/{user_role}'
defaults:
_entity_form: user_role.default
_title: 'Edit role'
requirements:
_entity_access: user_role.update
......@@ -110,7 +111,7 @@ user.role_delete:
path: '/admin/people/roles/manage/{user_role}/delete'
defaults:
_entity_form: user_role.delete
_title: 'Edit role'
_title: 'Delete role'
requirements:
_entity_access: user_role.delete
......
......@@ -126,6 +126,7 @@ views_ui.break_lock:
path: '/admin/structure/views/view/{view}/break-lock'
defaults:
_entity_form: 'view.break_lock'
_title: 'Break lock'
requirements:
_entity_access: view.break-lock
......
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