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: action.admin:
path: '/admin/config/system/actions' path: '/admin/config/system/actions'
defaults: defaults:
_title: 'Actions'
_entity_list: 'action' _entity_list: 'action'
requirements: requirements:
_permission: 'administer actions' _permission: 'administer actions'
......
...@@ -119,13 +119,9 @@ function aggregator_menu() { ...@@ -119,13 +119,9 @@ function aggregator_menu() {
'route_name' => 'aggregator.categories', 'route_name' => 'aggregator.categories',
); );
$items['aggregator/categories/%aggregator_category'] = array( $items['aggregator/categories/%aggregator_category'] = array(
'title callback' => '_aggregator_category_title',
'title arguments' => array(2),
'route_name' => 'aggregator.category_view', 'route_name' => 'aggregator.category_view',
); );
$items['aggregator/sources/%aggregator_feed'] = array( $items['aggregator/sources/%aggregator_feed'] = array(
'title callback' => 'entity_page_label',
'title arguments' => array(2),
'route_name' => 'aggregator.feed_view', 'route_name' => 'aggregator.feed_view',
); );
$items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array( $items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array(
...@@ -148,19 +144,6 @@ function aggregator_menu() { ...@@ -148,19 +144,6 @@ function aggregator_menu() {
return $items; 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(). * Implements hook_permission().
*/ */
......
...@@ -10,6 +10,7 @@ aggregator.admin_settings: ...@@ -10,6 +10,7 @@ aggregator.admin_settings:
path: '/admin/config/services/aggregator/settings' path: '/admin/config/services/aggregator/settings'
defaults: defaults:
_form: '\Drupal\aggregator\Form\SettingsForm' _form: '\Drupal\aggregator\Form\SettingsForm'
_title: 'Settings'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -17,6 +18,7 @@ aggregator.feed_items_delete: ...@@ -17,6 +18,7 @@ aggregator.feed_items_delete:
path: '/admin/config/services/aggregator/remove/{aggregator_feed}' path: '/admin/config/services/aggregator/remove/{aggregator_feed}'
defaults: defaults:
_entity_form: 'aggregator_feed.remove_items' _entity_form: 'aggregator_feed.remove_items'
_title: 'Remove items'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -24,6 +26,7 @@ aggregator.feed_delete: ...@@ -24,6 +26,7 @@ aggregator.feed_delete:
path: '/admin/config/services/aggregator/delete/feed/{aggregator_feed}' path: '/admin/config/services/aggregator/delete/feed/{aggregator_feed}'
defaults: defaults:
_entity_form: 'aggregator_feed.delete' _entity_form: 'aggregator_feed.delete'
_title: 'Delete feed'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -31,6 +34,7 @@ aggregator.feed_add: ...@@ -31,6 +34,7 @@ aggregator.feed_add:
path: '/admin/config/services/aggregator/add/feed' path: '/admin/config/services/aggregator/add/feed'
defaults: defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::feedAdd' _content: '\Drupal\aggregator\Controller\AggregatorController::feedAdd'
_title: 'Add feed'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -38,6 +42,7 @@ aggregator.feed_configure: ...@@ -38,6 +42,7 @@ aggregator.feed_configure:
path: '/aggregator/sources/{aggregator_feed}/configure' path: '/aggregator/sources/{aggregator_feed}/configure'
defaults: defaults:
_entity_form: 'aggregator_feed.default' _entity_form: 'aggregator_feed.default'
_title: 'Configure'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -45,6 +50,7 @@ aggregator.feed_edit: ...@@ -45,6 +50,7 @@ aggregator.feed_edit:
path: '/admin/config/services/aggregator/edit/feed/{aggregator_feed}' path: '/admin/config/services/aggregator/edit/feed/{aggregator_feed}'
defaults: defaults:
_entity_form: 'aggregator_feed.default' _entity_form: 'aggregator_feed.default'
_title: 'Edit feed'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -52,6 +58,7 @@ aggregator.feed_refresh: ...@@ -52,6 +58,7 @@ aggregator.feed_refresh:
path: '/admin/config/services/aggregator/update/{aggregator_feed}' path: '/admin/config/services/aggregator/update/{aggregator_feed}'
defaults: defaults:
_controller: '\Drupal\aggregator\Controller\AggregatorController::feedRefresh' _controller: '\Drupal\aggregator\Controller\AggregatorController::feedRefresh'
_title: 'Update items'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -59,6 +66,7 @@ aggregator.opml_add: ...@@ -59,6 +66,7 @@ aggregator.opml_add:
path: '/admin/config/services/aggregator/add/opml' path: '/admin/config/services/aggregator/add/opml'
defaults: defaults:
_form: '\Drupal\aggregator\Form\OpmlFeedAdd' _form: '\Drupal\aggregator\Form\OpmlFeedAdd'
_title: 'Import OMPL'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -66,6 +74,7 @@ aggregator.feed_view: ...@@ -66,6 +74,7 @@ aggregator.feed_view:
path: '/aggregator/sources/{aggregator_feed}' path: '/aggregator/sources/{aggregator_feed}'
defaults: defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::viewFeed' _content: '\Drupal\aggregator\Controller\AggregatorController::viewFeed'
_title_callback: '\Drupal\aggregator\Controller\AggregatorController::feedTitle'
requirements: requirements:
_permission: 'access news feeds' _permission: 'access news feeds'
...@@ -73,6 +82,7 @@ aggregator.page_last: ...@@ -73,6 +82,7 @@ aggregator.page_last:
path: '/aggregator' path: '/aggregator'
defaults: defaults:
_controller: '\Drupal\aggregator\Controller\AggregatorController::pageLast' _controller: '\Drupal\aggregator\Controller\AggregatorController::pageLast'
_title: 'Feed aggregator'
requirements: requirements:
_permission: 'access news feeds' _permission: 'access news feeds'
...@@ -80,6 +90,7 @@ aggregator.sources: ...@@ -80,6 +90,7 @@ aggregator.sources:
path: '/aggregator/sources' path: '/aggregator/sources'
defaults: defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::sources' _content: '\Drupal\aggregator\Controller\AggregatorController::sources'
_title: 'Sources'
requirements: requirements:
_permission: 'access news feeds' _permission: 'access news feeds'
...@@ -87,6 +98,7 @@ aggregator.categories: ...@@ -87,6 +98,7 @@ aggregator.categories:
path: '/aggregator/categories' path: '/aggregator/categories'
defaults: defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::categories' _content: '\Drupal\aggregator\Controller\AggregatorController::categories'
_title: 'Categories'
requirements: requirements:
_access_aggregator_categories: 'TRUE' _access_aggregator_categories: 'TRUE'
...@@ -94,6 +106,7 @@ aggregator.category_view: ...@@ -94,6 +106,7 @@ aggregator.category_view:
path: '/aggregator/categories/{cid}' path: '/aggregator/categories/{cid}'
defaults: defaults:
_content: '\Drupal\aggregator\Controller\AggregatorController::viewCategory' _content: '\Drupal\aggregator\Controller\AggregatorController::viewCategory'
_title_callback: '\Drupal\aggregator\Controller\AggregatorController::categoryTitle'
requirements: requirements:
_permission: 'access news feeds' _permission: 'access news feeds'
...@@ -101,6 +114,7 @@ aggregator.category_edit: ...@@ -101,6 +114,7 @@ aggregator.category_edit:
path: '/aggregator/categories/{cid}/configure' path: '/aggregator/categories/{cid}/configure'
defaults: defaults:
_form: '\Drupal\aggregator\Form\CategoryAdminForm' _form: '\Drupal\aggregator\Form\CategoryAdminForm'
_title: 'Configure'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -115,6 +129,7 @@ aggregator.category_delete: ...@@ -115,6 +129,7 @@ aggregator.category_delete:
path: '/admin/config/services/aggregator/delete/category/{cid}' path: '/admin/config/services/aggregator/delete/category/{cid}'
defaults: defaults:
_form: '\Drupal\aggregator\Form\CategoryDeleteForm' _form: '\Drupal\aggregator\Form\CategoryDeleteForm'
_title: 'Delete category'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -122,6 +137,7 @@ aggregator.category_add: ...@@ -122,6 +137,7 @@ aggregator.category_add:
path: '/admin/config/services/aggregator/add/category' path: '/admin/config/services/aggregator/add/category'
defaults: defaults:
_form: '\Drupal\aggregator\Form\CategoryAdminForm' _form: '\Drupal\aggregator\Form\CategoryAdminForm'
_title: 'Add category'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -129,6 +145,7 @@ aggregator.categorize_category_form: ...@@ -129,6 +145,7 @@ aggregator.categorize_category_form:
path: '/aggregator/categories/{cid}/categorize' path: '/aggregator/categories/{cid}/categorize'
defaults: defaults:
_form: '\Drupal\aggregator\Form\CategorizeCategoryForm' _form: '\Drupal\aggregator\Form\CategorizeCategoryForm'
_title: 'Categorize'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
...@@ -136,6 +153,7 @@ aggregator.categorize_feed_form: ...@@ -136,6 +153,7 @@ aggregator.categorize_feed_form:
path: '/aggregator/sources/{aggregator_feed}/categorize' path: '/aggregator/sources/{aggregator_feed}/categorize'
defaults: defaults:
_form: '\Drupal\aggregator\Form\CategorizeFeedForm' _form: '\Drupal\aggregator\Form\CategorizeFeedForm'
_title: 'Categorize'
requirements: requirements:
_permission: 'administer news feeds' _permission: 'administer news feeds'
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\aggregator\Controller; namespace Drupal\aggregator\Controller;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\aggregator\CategoryStorageControllerInterface; use Drupal\aggregator\CategoryStorageControllerInterface;
...@@ -92,7 +93,6 @@ public function viewFeed(FeedInterface $aggregator_feed) { ...@@ -92,7 +93,6 @@ public function viewFeed(FeedInterface $aggregator_feed) {
$items = $entity_manager->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id()); $items = $entity_manager->getStorageController('aggregator_item')->loadByFeed($aggregator_feed->id());
// Print the feed items. // Print the feed items.
$build = $this->buildPageList($items, $feed_source); $build = $this->buildPageList($items, $feed_source);
$build['#title'] = $aggregator_feed->label();
return $build; return $build;
} }
...@@ -106,10 +106,8 @@ public function viewFeed(FeedInterface $aggregator_feed) { ...@@ -106,10 +106,8 @@ public function viewFeed(FeedInterface $aggregator_feed) {
* The render array with list of items for the feed. * The render array with list of items for the feed.
*/ */
public function viewCategory($cid) { public function viewCategory($cid) {
$category = $this->categoryStorage->load($cid);
$items = $this->entityManager()->getStorageController('aggregator_item')->loadByCategory($cid); $items = $this->entityManager()->getStorageController('aggregator_item')->loadByCategory($cid);
$build = $this->buildPageList($items); $build = $this->buildPageList($items);
$build['#title'] = $category->title;
return $build; return $build;
} }
...@@ -384,4 +382,31 @@ public function opmlPage($cid = NULL) { ...@@ -384,4 +382,31 @@ public function opmlPage($cid = NULL) {
return $response; 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: ...@@ -2,6 +2,7 @@ ban.admin_page:
path: '/admin/config/people/ban/{default_ip}' path: '/admin/config/people/ban/{default_ip}'
defaults: defaults:
_form: '\Drupal\ban\Form\BanAdmin' _form: '\Drupal\ban\Form\BanAdmin'
_title: 'IP address bans'
default_ip: '' default_ip: ''
requirements: requirements:
_permission: 'ban IP addresses' _permission: 'ban IP addresses'
...@@ -10,5 +11,6 @@ ban.delete: ...@@ -10,5 +11,6 @@ ban.delete:
path: '/admin/config/people/ban/delete/{ban_id}' path: '/admin/config/people/ban/delete/{ban_id}'
defaults: defaults:
_form: '\Drupal\ban\Form\BanDelete' _form: '\Drupal\ban\Form\BanDelete'
_title: 'Delete IP address'
requirements: requirements:
_permission: 'ban IP addresses' _permission: 'ban IP addresses'
...@@ -25,6 +25,7 @@ block.admin_display: ...@@ -25,6 +25,7 @@ block.admin_display:
path: '/admin/structure/block' path: '/admin/structure/block'
defaults: defaults:
_content: '\Drupal\block\Controller\BlockListController::listing' _content: '\Drupal\block\Controller\BlockListController::listing'
_title: 'Block layout'
requirements: requirements:
_permission: 'administer blocks' _permission: 'administer blocks'
......
...@@ -2,6 +2,7 @@ book.render: ...@@ -2,6 +2,7 @@ book.render:
path: '/book' path: '/book'
defaults: defaults:
_content: '\Drupal\book\Controller\BookController::bookRender' _content: '\Drupal\book\Controller\BookController::bookRender'
_title: 'Books'
requirements: requirements:
_permission: 'access content' _permission: 'access content'
...@@ -9,6 +10,7 @@ book.admin: ...@@ -9,6 +10,7 @@ book.admin:
path: '/admin/structure/book' path: '/admin/structure/book'
defaults: defaults:
_content: '\Drupal\book\Controller\BookController::adminOverview' _content: '\Drupal\book\Controller\BookController::adminOverview'
_title: 'Books'
requirements: requirements:
_permission: 'administer book outlines' _permission: 'administer book outlines'
...@@ -16,6 +18,7 @@ book.settings: ...@@ -16,6 +18,7 @@ book.settings:
path: '/admin/structure/book/settings' path: '/admin/structure/book/settings'
defaults: defaults:
_form: '\Drupal\book\Form\BookSettingsForm' _form: '\Drupal\book\Form\BookSettingsForm'
_title: 'Books'
requirements: requirements:
_permission: 'administer site configuration' _permission: 'administer site configuration'
...@@ -31,6 +34,7 @@ book.outline: ...@@ -31,6 +34,7 @@ book.outline:
path: '/node/{node}/outline' path: '/node/{node}/outline'
defaults: defaults:
_entity_form: 'node.book_outline' _entity_form: 'node.book_outline'
_title: 'Outline'
requirements: requirements:
_permission: 'administer book outlines' _permission: 'administer book outlines'
_entity_access: 'node.view' _entity_access: 'node.view'
......
...@@ -69,6 +69,7 @@ comment.bundle_list: ...@@ -69,6 +69,7 @@ comment.bundle_list:
path: '/admin/structure/comments' path: '/admin/structure/comments'
defaults: defaults:
_content: 'Drupal\comment\Controller\AdminController::overviewBundles' _content: 'Drupal\comment\Controller\AdminController::overviewBundles'
_title: 'Comment forms'
requirements: requirements:
_permission: 'administer comments' _permission: 'administer comments'
......
...@@ -10,6 +10,7 @@ contact.category_list: ...@@ -10,6 +10,7 @@ contact.category_list:
path: '/admin/structure/contact' path: '/admin/structure/contact'
defaults: defaults:
_entity_list: 'contact_category' _entity_list: 'contact_category'
_title: 'Contact form categories'
requirements: requirements:
_permission: 'administer contact forms' _permission: 'administer contact forms'
...@@ -25,6 +26,7 @@ contact.category_edit: ...@@ -25,6 +26,7 @@ contact.category_edit:
path: '/admin/structure/contact/manage/{contact_category}' path: '/admin/structure/contact/manage/{contact_category}'
defaults: defaults:
_entity_form: contact_category.edit _entity_form: contact_category.edit
_title: 'Edit contact category'
requirements: requirements:
_entity_access: contact_category.update _entity_access: contact_category.update
......
...@@ -2,6 +2,7 @@ dblog.overview: ...@@ -2,6 +2,7 @@ dblog.overview:
path: '/admin/reports/dblog' path: '/admin/reports/dblog'
defaults: defaults:
_content: '\Drupal\dblog\Controller\DbLogController::overview' _content: '\Drupal\dblog\Controller\DbLogController::overview'
_title: 'Recent log messages'
requirements: requirements:
_permission: 'access site reports' _permission: 'access site reports'
...@@ -9,6 +10,7 @@ dblog.event: ...@@ -9,6 +10,7 @@ dblog.event:
path: '/admin/reports/event/{event_id}' path: '/admin/reports/event/{event_id}'
defaults: defaults:
_content: '\Drupal\dblog\Controller\DbLogController::eventDetails' _content: '\Drupal\dblog\Controller\DbLogController::eventDetails'
_title: 'Details'
requirements: requirements:
_permission: 'access site reports' _permission: 'access site reports'
......
...@@ -2,6 +2,7 @@ entity.display_mode: ...@@ -2,6 +2,7 @@ entity.display_mode:
path: '/admin/structure/display-modes' path: '/admin/structure/display-modes'
defaults: defaults:
_content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Display modes'
requirements: requirements:
_permission: 'administer display modes' _permission: 'administer display modes'
...@@ -9,6 +10,7 @@ entity.view_mode_list: ...@@ -9,6 +10,7 @@ entity.view_mode_list:
path: '/admin/structure/display-modes/view' path: '/admin/structure/display-modes/view'
defaults: defaults:
_entity_list: 'view_mode' _entity_list: 'view_mode'
_title: 'View modes'
requirements: requirements:
_permission: 'administer display modes' _permission: 'administer display modes'
...@@ -24,6 +26,7 @@ entity.view_mode_add_type: ...@@ -24,6 +26,7 @@ entity.view_mode_add_type:
path: '/admin/structure/display-modes/view/add/{entity_type}' path: '/admin/structure/display-modes/view/add/{entity_type}'
defaults: defaults:
_entity_form: 'view_mode.add' _entity_form: 'view_mode.add'
_title: 'Add view mode'
requirements: requirements:
_permission: 'administer display modes' _permission: 'administer display modes'
...@@ -31,6 +34,7 @@ entity.view_mode_edit: ...@@ -31,6 +34,7 @@ entity.view_mode_edit:
path: '/admin/structure/display-modes/view/manage/{view_mode}' path: '/admin/structure/display-modes/view/manage/{view_mode}'
defaults: defaults:
_entity_form: 'view_mode.edit' _entity_form: 'view_mode.edit'
_title: 'Edit view mode'
requirements: requirements:
_entity_access: 'view_mode.update' _entity_access: 'view_mode.update'
...@@ -38,6 +42,7 @@ entity.view_mode_delete: ...@@ -38,6 +42,7 @@ entity.view_mode_delete:
path: '/admin/structure/display-modes/view/manage/{view_mode}/delete' path: '/admin/structure/display-modes/view/manage/{view_mode}/delete'
defaults: defaults:
_entity_form: 'view_mode.delete' _entity_form: 'view_mode.delete'
_title: 'Delete view mode'
requirements: requirements:
_entity_access: 'view_mode.delete' _entity_access: 'view_mode.delete'
...@@ -45,6 +50,7 @@ entity.form_mode_list: ...@@ -45,6 +50,7 @@ entity.form_mode_list:
path: '/admin/structure/display-modes/form' path: '/admin/structure/display-modes/form'
defaults: defaults:
_entity_list: 'form_mode' _entity_list: 'form_mode'
_title: 'Form modes'
requirements: requirements:
_permission: 'administer display modes' _permission: 'administer display modes'
...@@ -60,6 +66,7 @@ entity.form_mode_add_type: ...@@ -60,6 +66,7 @@ entity.form_mode_add_type:
path: '/admin/structure/display-modes/form/add/{entity_type}' path: '/admin/structure/display-modes/form/add/{entity_type}'
defaults: defaults:
_entity_form: 'form_mode.add' _entity_form: 'form_mode.add'
_title: 'Add form mode'
requirements: requirements:
_permission: 'administer display modes' _permission: 'administer display modes'
...@@ -67,6 +74,7 @@ entity.form_mode_edit: ...@@ -67,6 +74,7 @@ entity.form_mode_edit:
<