Commit 063b5cd3 authored by webchick's avatar webchick

Issue #2143933 by tim.plunkett, pwolanin, dawehner: Add _title and _title_callback to all routes.

parent 405d5047
action.admin:
path: '/admin/config/system/actions'
defaults:
_title: 'Actions'
_entity_list: 'action'
requirements:
_permission: 'administer actions'
......
......@@ -119,13 +119,9 @@ function aggregator_menu() {
'route_name' => 'aggregator.categories',
);
$items['aggregator/categories/%aggregator_category'] = array(
'title callback' => '_aggregator_category_title',
'title arguments' => array(2),
'route_name' => 'aggregator.category_view',
);
$items['aggregator/sources/%aggregator_feed'] = array(
'title callback' => 'entity_page_label',
'title arguments' => array(2),
'route_name' => 'aggregator.feed_view',
);
$items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array(
......@@ -148,19 +144,6 @@ function aggregator_menu() {
return $items;
}
/**
* Title callback: Returns a title for aggregator category pages.
*
* @param $category
* An aggregator category.
*
* @return
* A string with the aggregator category title.
*/
function _aggregator_category_title($category) {
return $category->title;
}
/**
* Implements hook_permission().
*/
......
......@@ -10,6 +10,7 @@ aggregator.admin_settings:
path: '/admin/config/services/aggregator/settings'
defaults:
_form: '\Drupal\aggregator\Form\SettingsForm'
_title: 'Settings'
requirements:
_permission: 'administer news feeds'
......@@ -17,6 +18,7 @@ aggregator.feed_items_delete:
path: '/admin/config/services/aggregator/remove/{aggregator_feed}'
defaults:
_entity_form: 'aggregator_feed.remove_items'
_title: 'Remove items'
requirements:
_permission: 'administer news feeds'
......@@ -24,6 +26,7 @@ aggregator.feed_delete:
path: '/admin/config/services/aggregator/delete/feed/{aggregator_feed}'
defaults:
_entity_form: 'aggregator_feed.delete'
_title: 'Delete feed'
requirements:
_permission: 'administer news feeds'
......@@ -31,6 +34,7 @@ aggregator.feed_add:
path: '/admin/config/services/aggregator/add/feed'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
_title: 'Add feed'
requirements:
_permission: 'administer news feeds'
......@@ -38,6 +42,7 @@ aggregator.feed_configure:
path: '/aggregator/sources/{aggregator_feed}/configure'
defaults:
_entity_form: 'aggregator_feed.default'
_title: 'Configure'
requirements:
_permission: 'administer news feeds'
......@@ -45,6 +50,7 @@ aggregator.feed_edit:
path: '/admin/config/services/aggregator/edit/feed/{aggregator_feed}'
defaults:
_entity_form: 'aggregator_feed.default'
_title: 'Edit feed'
requirements:
_permission: 'administer news feeds'
......@@ -52,6 +58,7 @@ aggregator.feed_refresh:
path: '/admin/config/services/aggregator/update/{aggregator_feed}'
defaults:
_controller: '\Drupal\aggregator\Controller\AggregatorController::feedRefresh'
_title: 'Update items'
requirements:
_permission: 'administer news feeds'
......@@ -59,6 +66,7 @@ aggregator.opml_add:
path: '/admin/config/services/aggregator/add/opml'
defaults:
_form: '\Drupal\aggregator\Form\OpmlFeedAdd'
_title: 'Import OMPL'
requirements:
_permission: 'administer news feeds'
......@@ -66,6 +74,7 @@ aggregator.feed_view:
path: '/aggregator/sources/{aggregator_feed}'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::viewFeed'
_title_callback: '\Drupal\aggregator\Controller\AggregatorController::feedTitle'
requirements:
_permission: 'access news feeds'
......@@ -73,6 +82,7 @@ aggregator.page_last:
path: '/aggregator'
defaults:
_controller: '\Drupal\aggregator\Controller\AggregatorController::pageLast'
_title: 'Feed aggregator'
requirements:
_permission: 'access news feeds'
......@@ -80,6 +90,7 @@ aggregator.sources:
path: '/aggregator/sources'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::sources'
_title: 'Sources'
requirements:
_permission: 'access news feeds'
......@@ -87,6 +98,7 @@ aggregator.categories:
path: '/aggregator/categories'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::categories'
_title: 'Categories'
requirements:
_access_aggregator_categories: 'TRUE'
......@@ -94,6 +106,7 @@ aggregator.category_view:
path: '/aggregator/categories/{cid}'
defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::viewCategory'
_title_callback: '\Drupal\aggregator\Controller\AggregatorController::categoryTitle'
requirements:
_permission: 'access news feeds'
......@@ -101,6 +114,7 @@ aggregator.category_edit:
path: '/aggregator/categories/{cid}/configure'
defaults:
_form: '\Drupal\aggregator\Form\CategoryAdminForm'
_title: 'Configure'
requirements:
_permission: 'administer news feeds'
......@@ -115,6 +129,7 @@ aggregator.category_delete:
path: '/admin/config/services/aggregator/delete/category/{cid}'
defaults:
_form: '\Drupal\aggregator\Form\CategoryDeleteForm'
_title: 'Delete category'
requirements:
_permission: 'administer news feeds'
......@@ -122,6 +137,7 @@ aggregator.category_add:
path: '/admin/config/services/aggregator/add/category'
defaults:
_form: '\Drupal\aggregator\Form\CategoryAdminForm'
_title: 'Add category'
requirements:
_permission: 'administer news feeds'
......@@ -129,6 +145,7 @@ aggregator.categorize_category_form:
path: '/aggregator/categories/{cid}/categorize'
defaults:
_form: '\Drupal\aggregator\Form\CategorizeCategoryForm'
_title: 'Categorize'
requirements:
_permission: 'administer news feeds'
......@@ -136,6 +153,7 @@ aggregator.categorize_feed_form:
path: '/aggregator/sources/{aggregator_feed}/categorize'
defaults:
_form: '\Drupal\aggregator\Form\CategorizeFeedForm'
_title: 'Categorize'
requirements:
_permission: 'administer news feeds'
......
......@@ -7,6 +7,7 @@
namespace Drupal\aggregator\Controller;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\aggregator\CategoryStorageControllerInterface;
......@@ -92,7 +93,6 @@ public function viewFeed(FeedInterface $aggregator_feed) {
$items = $entity_manager->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id());
// Print the feed items.
$build = $this->buildPageList($items, $feed_source);
$build['#title'] = $aggregator_feed->label();
return $build;
}
......@@ -106,10 +106,8 @@ public function viewFeed(FeedInterface $aggregator_feed) {
* The render array with list of items for the feed.
*/
public function viewCategory($cid) {
$category = $this->categoryStorage->load($cid);
$items = $this->entityManager()->getStorageController('aggregator_item')->loadByCategory($cid);
$build = $this->buildPageList($items);
$build['#title'] = $category->title;
return $build;
}
......@@ -384,4 +382,31 @@ public function opmlPage($cid = NULL) {
return $response;
}
/**
* Route title callback.
*
* @param \Drupal\aggregator\FeedInterface $aggregator_feed
* The aggregator feed.
*
* @return string
* The feed label.
*/
public function feedTitle(FeedInterface $aggregator_feed) {
return Xss::filter($aggregator_feed->label());
}
/**
* Route title callback.
*
* @param int $cid
* The category ID.
*
* @return string
* The category label.
*/
public function categoryTitle($cid) {
$category = $this->categoryStorage->load($cid);
return Xss::filter($category->title);
}
}
......@@ -2,6 +2,7 @@ ban.admin_page:
path: '/admin/config/people/ban/{default_ip}'
defaults:
_form: '\Drupal\ban\Form\BanAdmin'
_title: 'IP address bans'
default_ip: ''
requirements:
_permission: 'ban IP addresses'
......@@ -10,5 +11,6 @@ ban.delete:
path: '/admin/config/people/ban/delete/{ban_id}'
defaults:
_form: '\Drupal\ban\Form\BanDelete'
_title: 'Delete IP address'
requirements:
_permission: 'ban IP addresses'
......@@ -25,6 +25,7 @@ block.admin_display:
path: '/admin/structure/block'
defaults:
_content: '\Drupal\block\Controller\BlockListController::listing'
_title: 'Block layout'
requirements:
_permission: 'administer blocks'
......
......@@ -2,6 +2,7 @@ book.render:
path: '/book'
defaults:
_content: '\Drupal\book\Controller\BookController::bookRender'
_title: 'Books'
requirements:
_permission: 'access content'
......@@ -9,6 +10,7 @@ book.admin:
path: '/admin/structure/book'
defaults:
_content: '\Drupal\book\Controller\BookController::adminOverview'
_title: 'Books'
requirements:
_permission: 'administer book outlines'
......@@ -16,6 +18,7 @@ book.settings:
path: '/admin/structure/book/settings'
defaults:
_form: '\Drupal\book\Form\BookSettingsForm'
_title: 'Books'
requirements:
_permission: 'administer site configuration'
......@@ -31,6 +34,7 @@ book.outline:
path: '/node/{node}/outline'
defaults:
_entity_form: 'node.book_outline'
_title: 'Outline'
requirements:
_permission: 'administer book outlines'
_entity_access: 'node.view'
......
......@@ -69,6 +69,7 @@ comment.bundle_list:
path: '/admin/structure/comments'
defaults:
_content: 'Drupal\comment\Controller\AdminController::overviewBundles'
_title: 'Comment forms'
requirements:
_permission: 'administer comments'
......
......@@ -10,6 +10,7 @@ contact.category_list:
path: '/admin/structure/contact'
defaults:
_entity_list: 'contact_category'
_title: 'Contact form categories'
requirements:
_permission: 'administer contact forms'
......@@ -25,6 +26,7 @@ contact.category_edit:
path: '/admin/structure/contact/manage/{contact_category}'
defaults:
_entity_form: contact_category.edit
_title: 'Edit contact category'
requirements:
_entity_access: contact_category.update
......
......@@ -2,6 +2,7 @@ dblog.overview:
path: '/admin/reports/dblog'
defaults:
_content: '\Drupal\dblog\Controller\DbLogController::overview'
_title: 'Recent log messages'
requirements:
_permission: 'access site reports'
......@@ -9,6 +10,7 @@ dblog.event:
path: '/admin/reports/event/{event_id}'
defaults:
_content: '\Drupal\dblog\Controller\DbLogController::eventDetails'
_title: 'Details'
requirements:
_permission: 'access site reports'
......
......@@ -2,6 +2,7 @@ entity.display_mode:
path: '/admin/structure/display-modes'
defaults:
_content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Display modes'
requirements:
_permission: 'administer display modes'
......@@ -9,6 +10,7 @@ entity.view_mode_list:
path: '/admin/structure/display-modes/view'
defaults:
_entity_list: 'view_mode'
_title: 'View modes'
requirements:
_permission: 'administer display modes'
......@@ -24,6 +26,7 @@ entity.view_mode_add_type:
path: '/admin/structure/display-modes/view/add/{entity_type}'
defaults:
_entity_form: 'view_mode.add'
_title: 'Add view mode'
requirements:
_permission: 'administer display modes'
......@@ -31,6 +34,7 @@ entity.view_mode_edit:
path: '/admin/structure/display-modes/view/manage/{view_mode}'
defaults:
_entity_form: 'view_mode.edit'
_title: 'Edit view mode'
requirements:
_entity_access: 'view_mode.update'
......@@ -38,6 +42,7 @@ entity.view_mode_delete:
path: '/admin/structure/display-modes/view/manage/{view_mode}/delete'
defaults:
_entity_form: 'view_mode.delete'
_title: 'Delete view mode'
requirements:
_entity_access: 'view_mode.delete'
......@@ -45,6 +50,7 @@ entity.form_mode_list:
path: '/admin/structure/display-modes/form'
defaults:
_entity_list: 'form_mode'
_title: 'Form modes'
requirements:
_permission: 'administer display modes'
......@@ -60,6 +66,7 @@ entity.form_mode_add_type:
path: '/admin/structure/display-modes/form/add/{entity_type}'
defaults:
_entity_form: 'form_mode.add'
_title: 'Add form mode'
requirements:
_permission: 'administer display modes'
......@@ -67,6 +74,7 @@ entity.form_mode_edit:
path: '/admin/structure/display-modes/form/manage/{form_mode}'
defaults:
_entity_form: 'form_mode.edit'
_title: 'Edit form mode'
requirements:
_entity_access: 'form_mode.update'
......@@ -74,5 +82,6 @@ entity.form_mode_delete:
path: '/admin/structure/display-modes/form/manage/{form_mode}/delete'
defaults:
_entity_form: 'form_mode.delete'
_title: 'Delete form mode'
requirements:
_entity_access: 'form_mode.delete'
......@@ -2,5 +2,6 @@ field_ui.list:
path: '/admin/reports/fields'
defaults:
_entity_list: 'field_entity'
_title: 'Field list'
requirements:
_permission: 'administer content types'
......@@ -2,6 +2,7 @@ filter.tips_all:
path: '/filter/tips'
defaults:
_content: '\Drupal\filter\Controller\FilterController::filterTips'
_title: 'Compose tips'
requirements:
_access: 'TRUE'
......@@ -9,6 +10,7 @@ filter.tips:
path: '/filter/tips/{filter_format}'
defaults:
_content: '\Drupal\filter\Controller\FilterController::filterTips'
_title: 'Compose tips'
requirements:
_entity_access: 'filter_format.view'
......@@ -40,6 +42,7 @@ filter.admin_disable:
path: '/admin/config/content/formats/manage/{filter_format}/disable'
defaults:
_entity_form: 'filter_format.disable'
_title: 'Disable text format'
requirements:
_filter_disable_format_access: 'TRUE'
_permission: 'administer filters'
......@@ -2,6 +2,7 @@ forum.delete:
path: '/admin/structure/forum/delete/forum/{taxonomy_term}'
defaults:
_form: '\Drupal\forum\Form\DeleteForm'
_title: 'Delete forum'
requirements:
_permission: 'administer forums'
......@@ -9,6 +10,7 @@ forum.settings:
path: '/admin/structure/forum/settings'
defaults:
_form: '\Drupal\forum\ForumSettingsForm'
_title: 'Forums'
requirements:
_permission: 'administer forums'
......@@ -16,6 +18,7 @@ forum.index:
path: '/forum'
defaults:
_content: '\Drupal\forum\Controller\ForumController::forumIndex'
_title: 'Forums'
requirements:
_permission: 'access content'
......@@ -30,6 +33,7 @@ forum.add_container:
path: '/admin/structure/forum/add/container'
defaults:
_content: '\Drupal\forum\Controller\ForumController::addContainer'
_title: 'Add container'
requirements:
_permission: 'administer forums'
......@@ -37,6 +41,7 @@ forum.add_forum:
path: '/admin/structure/forum/add/forum'
defaults:
_content: '\Drupal\forum\Controller\ForumController::addForum'
_title: 'Add forum'
requirements:
_permission: 'administer forums'
......@@ -44,6 +49,7 @@ forum.edit_container:
path: '/admin/structure/forum/edit/container/{taxonomy_term}'
defaults:
_entity_form: 'taxonomy_term.container'
_title: 'Edit container'
requirements:
_permission: 'administer forums'
......@@ -51,6 +57,7 @@ forum.edit_forum:
path: '/admin/structure/forum/edit/forum/{taxonomy_term}'
defaults:
_entity_form: 'taxonomy_term.forum'
_title: 'Edit forum'
requirements:
_permission: 'administer forums'
......@@ -58,5 +65,6 @@ forum.overview:
path: '/admin/structure/forum'
defaults:
_form: '\Drupal\forum\Form\Overview'
_title: 'Forums'
requirements:
_permission: 'administer forums'
......@@ -2,6 +2,7 @@ help.main:
path: '/admin/help'
defaults:
_content: '\Drupal\help\Controller\HelpController::helpMain'
_title: 'Help'
requirements:
_permission: 'access administration pages'
......@@ -9,5 +10,6 @@ help.page:
path: '/admin/help/{name}'
defaults:
_content: '\Drupal\help\Controller\HelpController::helpPage'
_title: 'Help'
requirements:
_permission: 'access administration pages'
......@@ -2,6 +2,7 @@ image.style_add:
path: '/admin/config/media/image-styles/add'
defaults:
_entity_form: image_style.add
_title: 'Add image style'
requirements:
_permission: 'administer image styles'
......@@ -9,6 +10,7 @@ image.style_edit:
path: '/admin/config/media/image-styles/manage/{image_style}'
defaults:
_entity_form: image_style.edit
_title: 'Edit style'
requirements:
_permission: 'administer image styles'
......@@ -32,6 +34,7 @@ image.effect_delete:
path: '/admin/config/media/image-styles/manage/{image_style}/effects/{image_effect}/delete'
defaults:
_form: '\Drupal\image\Form\ImageEffectDeleteForm'
_title: 'Delete image effect'
requirements:
_permission: 'administer image styles'
......@@ -39,6 +42,7 @@ image.style_list:
path: '/admin/config/media/image-styles'
defaults:
_entity_list: 'image_style'
_title: 'Image styles'
requirements:
_permission: 'administer image styles'
......@@ -53,6 +57,7 @@ image.effect_add_form:
path: '/admin/config/media/image-styles/manage/{image_style}/add/{image_effect}'
defaults:
_form: '\Drupal\image\Form\ImageEffectAddForm'
_title: 'Add image effect'
requirements:
_permission: 'administer image styles'
......@@ -60,5 +65,6 @@ image.effect_edit_form:
path: '/admin/config/media/image-styles/manage/{image_style}/effects/{image_effect}'
defaults:
_form: '\Drupal\image\Form\ImageEffectEditForm'
_title: 'Edit image effect'
requirements:
_permission: 'administer image styles'
......@@ -23,6 +23,7 @@ language.add:
path: '/admin/config/regional/language/add'
defaults:
_entity_form: 'language_entity.add'
_title: 'Add language'
requirements:
_entity_create_access: 'language_entity'
......@@ -38,6 +39,7 @@ language.admin_overview:
path: '/admin/config/regional/language'
defaults:
_entity_list: 'language_entity'
_title: 'Languages'
requirements:
_permission: 'administer languages'
......@@ -45,6 +47,7 @@ language.delete:
path: '/admin/config/regional/language/delete/{language_entity}'
defaults:
_entity_form: 'language_entity.delete'
_title: 'Delete language'
requirements:
_entity_access: 'language_entity.delete'
......
......@@ -2,6 +2,7 @@ locale.settings:
path: '/admin/config/regional/translate/settings'
defaults:
_form: 'Drupal\locale\Form\LocaleSettingsForm'
_title: 'Settings'
requirements:
_permission: 'translate interface'
......@@ -16,6 +17,7 @@ locale.translate_page:
path: '/admin/config/regional/translate'
defaults:
_content: 'Drupal\locale\Controller\LocaleController::translatePage'
_title: 'User interface translation'
requirements:
_permission: 'translate interface'
......
......@@ -7,6 +7,7 @@
namespace Drupal\menu\Controller;
use Drupal\Component\Utility\Xss;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\menu_link\MenuLinkStorageControllerInterface;
......@@ -96,4 +97,17 @@ public function addLink(MenuInterface $menu) {
return $this->entityManager->getForm($menu_link);
}
/**
* Route title callback.
*
* @param \Drupal\system\MenuInterface $menu
* The menu entity.
*
* @return string
* The menu label.
*/
public function menuTitle(MenuInterface $menu) {
return Xss::filter($menu->label());
}
}
......@@ -2,6 +2,7 @@ menu.settings:
path: '/admin/structure/menu/settings'
defaults:
_form: 'Drupal\menu\MenuSettingsForm'
_title: 'Menus'
requirements:
_permission: 'administer menu'
......@@ -32,6 +33,7 @@ menu.link_edit:
path: '/admin/structure/menu/item/{menu_link}/edit'
defaults:
_entity_form: 'menu_link'
_title: 'Edit menu link'
requirements:
_entity_access: 'menu_link.update'
......@@ -39,6 +41,7 @@ menu.link_reset:
path: '/admin/structure/menu/item/{menu_link}/reset'
defaults:
_entity_form: 'menu_link.reset'
_title: 'Reset menu link'
requirements:
_entity_access: 'menu_link.reset'
......@@ -46,6 +49,7 @@ menu.link_delete:
path: '/admin/structure/menu/item/{menu_link}/delete'
defaults:
_entity_form: 'menu_link.delete'
_title: 'Delete menu link'
requirements:
_entity_access: 'menu_link.delete'
......@@ -53,6 +57,7 @@ menu.menu_add:
path: '/admin/structure/menu/add'
defaults:
_entity_form: 'menu.add'
_title: 'Add menu'
requirements:
_entity_create_access: 'menu'
......@@ -60,6 +65,7 @@ menu.menu_edit:
path: '/admin/structure/menu/manage/{menu}'
defaults:
_entity_form: 'menu.edit'
_title_callback: '\Drupal\menu\Controller\MenuController::menuTitle'
requirements:
_entity_access: 'menu.update'
......
......@@ -182,7 +182,7 @@ function theme_node_preview($variables) {
* @deprecated Use \Drupal\node\Controller\NodeController::revisionOverview()
*/
function node_revision_overview($node) {
drupal_set_title(t('Revisions for %title', array('%title' => $node->label())), PASS_THROUGH);
$build['#title'] = t('Revisions for %title', array('%title' => $node->label()));
$header = array(t('Revision'), t('Operations'));
......
......@@ -74,6 +74,7 @@ node.revision_revert_confirm:
path: '/node/{node}/revisions/{node_revision}/revert'
defaults:
_form: '\Drupal\node\Form\NodeRevisionRevertForm'
_title: 'Revert to earlier revision'
requirements:
_access_node_revision: 'update'
......@@ -81,6 +82,7 @@ node.revision_delete_confirm:
path: '/node/{node}/revisions/{node_revision}/delete'
defaults:
_form: '\Drupal\node\Form\NodeRevisionDeleteForm'
_title: 'Delete earlier revision'
requirements:
_access_node_revision: 'delete'
......@@ -97,6 +99,7 @@ node.type_add:
path: '/admin/structure/types/add'
defaults:
_entity_form: 'node_type.add'
_title: 'Add content type'
requirements:
_permission: 'administer content types'
......
......@@ -2,6 +2,7 @@ path.delete:
path: '/admin/config/search/path/delete/{pid}'
defaults:
_form: '\Drupal\path\Form\DeleteForm'
_title: 'Delete alias'
requirements:
_permission: 'administer url aliases'
......
......@@ -2,6 +2,7 @@ picture.mapping_page:
path: '/admin/config/media/picturemapping'
defaults:
_entity_list: 'picture_mapping'
_title: 'Picture mappings'
requirements:
_permission: 'administer pictures'
......@@ -9,6 +10,7 @@ picture.mapping_page_add:
path: '/admin/config/media/picturemapping/add'
defaults:
_entity_form: 'picture_mapping.add'
_title: 'Add picture mapping'
requirements:
_permission: 'administer pictures'
......@@ -16,6 +18,7 @@ picture.mapping_page_edit:
path: '/admin/config/media/picturemapping/{picture_mapping}'
defaults:
_entity_form: 'picture_mapping.edit'
_title: 'Edit picture mapping'
requirements:
_permission: 'administer pictures'
......@@ -23,6 +26,7 @@ picture.mapping_page_duplicate:
path: '/admin/config/media/picturemapping/{picture_mapping}/duplicate'
defaults:
_entity_form: 'picture_mapping.duplicate'
_title: 'Duplicate picture mapping'
requirements:
_permission: 'administer pictures'
......
......@@ -2,6 +2,7 @@ search.settings:
path: '/admin/config/search/settings'