diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 1039b59..282aa92 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -195,11 +195,7 @@ function book_menu() { ); $items['node/%node/outline/remove'] = array( 'title' => 'Remove from outline', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('book_remove_form', 1), - 'access callback' => '_book_outline_remove_access', - 'access arguments' => array(1), - 'file' => 'book.pages.inc', + 'route_name' => 'book.remove', ); return $items; diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index fe4c6a0..5e7b4de 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -30,6 +30,8 @@ function book_remove_button_submit($form, &$form_state) { * @see book_remove_form_submit() * @see book_menu() * @ingroup forms + * + * @deprecated Use \Drupal\book\Form\BookForm::remove() */ function book_remove_form($form, &$form_state, EntityInterface $node) { $form['#node'] = $node; diff --git a/core/modules/book/book.routing.yml b/core/modules/book/book.routing.yml index 39aff5c..c97aa87 100644 --- a/core/modules/book/book.routing.yml +++ b/core/modules/book/book.routing.yml @@ -50,3 +50,15 @@ book.admin_edit: _permission: 'administer book outlines' _entity_access: 'node.view' node: \d+ + +book.remove: + path: '/node/{node}/outline/remove' + defaults: + _content: '\Drupal\book\Form\BookForm::remove' + _title: 'Remove from outline' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer book outlines' + _entity_access: 'node.view' + _access_book_removable: 'TRUE' diff --git a/core/modules/book/book.services.yml b/core/modules/book/book.services.yml index 510573a..2f1097a 100644 --- a/core/modules/book/book.services.yml +++ b/core/modules/book/book.services.yml @@ -5,3 +5,9 @@ services: book.export: class: Drupal\book\BookExport arguments: ['@entity.manager'] + + access_check.book.removable: + class: Drupal\book\Access\BookNodeIsRemovableAccessCheck + arguments: ['@book.manager'] + tags: + - { name: access_check } diff --git a/core/modules/book/lib/Drupal/book/Access/BookNodeIsRemovableAccessCheck.php b/core/modules/book/lib/Drupal/book/Access/BookNodeIsRemovableAccessCheck.php new file mode 100644 index 0000000..ccf343c --- /dev/null +++ b/core/modules/book/lib/Drupal/book/Access/BookNodeIsRemovableAccessCheck.php @@ -0,0 +1,55 @@ +bookManager = $book_manager; + } + + /** + * {@inheritdoc} + */ + public function appliesTo() { + return array('_access_book_removable'); + } + + /** + * {@inheritdoc} + */ + public function access(Route $route, Request $request) { + $node = $request->attributes->get('node'); + if (!empty($node)) { + return $this->bookManager->checkNodeIsRemovable($node) ? static::ALLOW : static::DENY; + } + return static::DENY; + } + +} diff --git a/core/modules/book/lib/Drupal/book/Form/BookForm.php b/core/modules/book/lib/Drupal/book/Form/BookForm.php new file mode 100644 index 0000000..c69ecd6 --- /dev/null +++ b/core/modules/book/lib/Drupal/book/Form/BookForm.php @@ -0,0 +1,26 @@ + 'Delete', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('content_translation_delete_confirm', $entity_position, $language_position), - 'access callback' => 'content_translation_delete_access', - 'access arguments' => $args, + 'route_name' => "content_translation.delete_$entity_type", ) + $item; } } diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index eb80f32..be151b9 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -248,6 +248,8 @@ function content_translation_prepare_translation(EntityInterface $entity, Langua /** * Form constructor for the translation deletion confirmation. + * + * @deprecated Use \Drupal\content_translation\Form\ContentTranslationForm::deleteTranslation() */ function content_translation_delete_confirm(array $form, array $form_state, EntityInterface $entity, Language $language) { $langcode = $language->id; diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php index 21eeea8..3a53710 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php @@ -57,26 +57,28 @@ public function access(Route $route, Request $request) { $translations = $entity->getTranslationLanguages(); $languages = language_list(); - if ($operation == 'create') { - $source = language_load($request->attributes->get('source')); - $target = language_load($request->attributes->get('target')); - $source = !empty($source) ? $source : $entity->language(); - $target = !empty($target) ? $target : language(Language::TYPE_CONTENT); - return ($source->id != $target->id - && isset($languages[$source->id]) - && isset($languages[$target->id]) - && !isset($translations[$target->id]) - && $controller->getTranslationAccess($entity, $operation)) - ? static::ALLOW : static::DENY; - } - elseif ($operation == 'update') { - $language = language_load($request->attributes->get('language')); - $language = !empty($language) ? $language : language(Language::TYPE_CONTENT); - return isset($languages[$language->id]) - && $language->id != $entity->getUntranslated()->language()->id - && isset($translations[$language->id]) - && $controller->getTranslationAccess($entity, $operation) - ? static::ALLOW : static::DENY; + switch ($operation) { + case 'create': + $source = language_load($request->attributes->get('source')); + $target = language_load($request->attributes->get('target')); + $source = !empty($source) ? $source : $entity->language(); + $target = !empty($target) ? $target : language(Language::TYPE_CONTENT); + return ($source->id != $target->id + && isset($languages[$source->id]) + && isset($languages[$target->id]) + && !isset($translations[$target->id]) + && $controller->getTranslationAccess($entity, $operation)) + ? static::ALLOW : static::DENY; + + case 'update': + case 'delete': + $language = language_load($request->attributes->get('language')); + $language = !empty($language) ? $language : language(Language::TYPE_CONTENT); + return isset($languages[$language->id]) + && $language->id != $entity->getUntranslated()->language()->id + && isset($translations[$language->id]) + && $controller->getTranslationAccess($entity, $operation) + ? static::ALLOW : static::DENY; } } return static::DENY; diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php new file mode 100644 index 0000000..7142a49 --- /dev/null +++ b/core/modules/content_translation/lib/Drupal/content_translation/Form/ContentTranslationForm.php @@ -0,0 +1,28 @@ +getRouteCollection(); foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { if ($entity_info['translatable'] && isset($entity_info['translation'])) { + $path = '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']) . '/translations'; $route = new Route( - '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']) . "/translations", + $path, array( '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::overview', '_title' => 'Translate', @@ -72,7 +73,7 @@ public function routes(RouteBuildEvent $event) { $collection->add("content_translation.translation_overview_$entity_type", $route); $route = new Route( - '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']) . "/translations/add/{source}/{target}", + $path . '/add/{source}/{target}', array( '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::add', 'source' => NULL, @@ -95,7 +96,7 @@ public function routes(RouteBuildEvent $event) { $collection->add("content_translation.translation_add_$entity_type", $route); $route = new Route( - '/' . str_replace($entity_info['menu_path_wildcard'], '{entity}', $entity_info['menu_base_path']) . "/translations/edit/{language}", + $path . '/edit/{language}', array( '_content' => '\Drupal\content_translation\Controller\ContentTranslationController::edit', 'language' => NULL, @@ -114,6 +115,27 @@ public function routes(RouteBuildEvent $event) { ) ); $collection->add("content_translation.translation_edit_$entity_type", $route); + + $route = new Route( + $path . '/delete/{language}', + array( + '_content' => '\Drupal\content_translation\Form\ContentTranslationForm::deleteTranslation', + 'language' => NULL, + '_title' => 'Delete', + ), + array( + '_permission' => 'translate any entity', + '_access_content_translation_manage' => 'delete', + ), + array( + 'parameters' => array( + 'entity' => array( + 'type' => 'entity:' . $entity_type, + ), + ), + ) + ); + $collection->add("content_translation.delete_$entity_type", $route); } } } diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc index c3f669c..f62b933 100644 --- a/core/modules/language/language.admin.inc +++ b/core/modules/language/language.admin.inc @@ -26,6 +26,8 @@ function language_admin_predefined_list() { /** * Builds the configuration form for language negotiation. + * + * @deprecated Use \Drupal\language\Form\LanguageForm::negotiation() */ function language_negotiation_configure_form() { language_negotiation_include(); diff --git a/core/modules/language/language.module b/core/modules/language/language.module index d85aad0..32d38eb 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -94,11 +94,8 @@ function language_menu() { // Language negotiation. $items['admin/config/regional/language/detection'] = array( 'title' => 'Detection and selection', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('language_negotiation_configure_form'), - 'access arguments' => array('administer languages'), + 'route_name' => 'language.negotiation', 'weight' => 10, - 'file' => 'language.admin.inc', 'type' => MENU_LOCAL_TASK, ); $items['admin/config/regional/language/detection/url'] = array( diff --git a/core/modules/language/language.routing.yml b/core/modules/language/language.routing.yml index 7494f1e..42bd9b3 100644 --- a/core/modules/language/language.routing.yml +++ b/core/modules/language/language.routing.yml @@ -47,6 +47,14 @@ language.delete: requirements: _entity_access: 'language_entity.delete' +language.negotiation: + path: '/admin/config/regional/language/detection' + defaults: + _content: '\Drupal\language\Form\LanguageForm::negotiation' + _title: 'Detection and selection' + requirements: + _permission: 'administer languages' + language.negotiation_browser: path: '/admin/config/regional/language/detection/browser' defaults: diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageForm.php b/core/modules/language/lib/Drupal/language/Form/LanguageForm.php new file mode 100644 index 0000000..9194c6b --- /dev/null +++ b/core/modules/language/lib/Drupal/language/Form/LanguageForm.php @@ -0,0 +1,24 @@ + 'Import', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('locale_translate_import_form'), - 'access arguments' => array('translate interface'), + 'route_name' => 'locale.translate_import', 'weight' => 20, 'type' => MENU_LOCAL_TASK, - 'file' => 'locale.bulk.inc', ); $items['admin/config/regional/translate/export'] = array( 'title' => 'Export', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('locale_translate_export_form'), - 'access arguments' => array('translate interface'), + 'route_name' => 'locale.translate_export', 'weight' => 30, 'type' => MENU_LOCAL_TASK, - 'file' => 'locale.bulk.inc', ); $items['admin/config/regional/translate/settings'] = array( 'title' => 'Settings', @@ -206,11 +200,8 @@ function locale_menu() { ); $items['admin/reports/translations'] = array( 'title' => 'Available translation updates', + 'route_name' => 'locale.translate_status', 'description' => 'Get a status report about available interface translations for your installed modules and themes.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('locale_translation_status_form'), - 'access arguments' => array('translate interface'), - 'file' => 'locale.pages.inc', ); return $items; diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index 1e045fe..3876e8d 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -40,6 +40,8 @@ function locale_translation_manual_status() { * Page callback: Display the current translation status. * * @see locale_menu() + * + * @deprecated Use \Drupal\locale\Form\LocaleForm::status() */ function locale_translation_status_form($form, &$form_state) { module_load_include('translation.inc', 'locale'); diff --git a/core/modules/locale/locale.routing.yml b/core/modules/locale/locale.routing.yml index 7b08569..cc60aec 100644 --- a/core/modules/locale/locale.routing.yml +++ b/core/modules/locale/locale.routing.yml @@ -18,3 +18,27 @@ locale.translate_page: _content: 'Drupal\locale\Controller\LocaleController::translatePage' requirements: _permission: 'translate interface' + +locale.translate_import: + path: '/admin/config/regional/translate/import' + defaults: + _content: '\Drupal\locale\Form\LocaleForm::import' + _title: 'Import' + requirements: + _permission: 'translate interface' + +locale.translate_export: + path: '/admin/config/regional/translate/export' + defaults: + _content: '\Drupal\locale\Form\LocaleForm::export' + _title: 'Export' + requirements: + _permission: 'translate interface' + +locale.translate_status: + path: '/admin/reports/translations' + defaults: + _content: '\Drupal\locale\Form\LocaleForm::status' + _title: 'Available translation updates' + requirements: + _permission: 'translate interface' diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkAccessCheck.php similarity index 79% rename from core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php rename to core/modules/shortcut/lib/Drupal/shortcut/Access/LinkAccessCheck.php index 30153df..85e48b2 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkDeleteAccessCheck.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/LinkAccessCheck.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\shortcut\Access\LinkDeleteAccessCheck. + * Contains Drupal\shortcut\Access\LinkAccessCheck. */ namespace Drupal\shortcut\Access; @@ -14,13 +14,13 @@ /** * Provides an access check for shortcut link delete routes. */ -class LinkDeleteAccessCheck implements StaticAccessCheckInterface { +class LinkAccessCheck implements StaticAccessCheckInterface { /** * {@inheritdoc} */ public function appliesTo() { - return array('_access_shortcut_link_delete'); + return array('_access_shortcut_link'); } /** @@ -32,6 +32,7 @@ public function access(Route $route, Request $request) { if ($shortcut_set = shortcut_set_load($set_name)) { return shortcut_set_edit_access($shortcut_set) ? static::ALLOW : static::DENY; } + return static::DENY; } } diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetEditAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetEditAccessCheck.php new file mode 100644 index 0000000..7ca4b01 --- /dev/null +++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetEditAccessCheck.php @@ -0,0 +1,43 @@ +attributes->get('shortcut_set'); + // Sufficiently-privileged users can edit their currently displayed shortcut + // set, but not other sets. Shortcut administrators can edit any set. + if ($account->hasPermission('administer shortcuts')) { + return static::ALLOW; + } + if ($account->hasPermission('customize shortcut links')) { + return !isset($shortcut_set) || $shortcut_set == shortcut_current_displayed_set() ? static::ALLOW : static::DENY; + } + return static::DENY; + } + +} diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetSwitchAccessCheck.php b/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetSwitchAccessCheck.php new file mode 100644 index 0000000..aacecc4 --- /dev/null +++ b/core/modules/shortcut/lib/Drupal/shortcut/Access/ShortcutSetSwitchAccessCheck.php @@ -0,0 +1,51 @@ +attributes->get('account'); + + if ($user->hasPermission('administer shortcuts')) { + // Administrators can switch anyone's shortcut set. + return static::ALLOW; + } + + if (!$user->hasPermission('switch shortcut sets')) { + // The user has no permission to switch anyone's shortcut set. + return static::DENY; + } + + if (!isset($account) || $user->id() == $account->id()) { + // Users with the 'switch shortcut sets' permission can switch their own + // shortcuts sets. + return static::ALLOW; + } + return static::DENY; + } + +} diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutForm.php b/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutForm.php new file mode 100644 index 0000000..fc5fec2 --- /dev/null +++ b/core/modules/shortcut/lib/Drupal/shortcut/Form/ShortcutForm.php @@ -0,0 +1,48 @@ + $shortcut_link['link_title']))); diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 325770a..8ca0472 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -113,20 +113,12 @@ function shortcut_menu() { ); $items['admin/config/user-interface/shortcut/manage/%shortcut_set/add-link'] = array( 'title' => 'Add shortcut', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('shortcut_link_add', 5), - 'access callback' => 'shortcut_set_edit_access', - 'access arguments' => array(5), + 'route_name' => 'shortcut.link_edit', 'type' => MENU_LOCAL_ACTION, - 'file' => 'shortcut.admin.inc', ); $items['admin/config/user-interface/shortcut/link/%menu_link'] = array( 'title' => 'Edit shortcut', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('shortcut_link_edit', 5), - 'access callback' => 'shortcut_link_access', - 'access arguments' => array(5), - 'file' => 'shortcut.admin.inc', + 'route_name' => 'shortcut.link_edit', ); $items['admin/config/user-interface/shortcut/link/%menu_link/delete'] = array( 'title' => 'Delete shortcut', @@ -134,12 +126,8 @@ function shortcut_menu() { ); $items['user/%user/shortcuts'] = array( 'title' => 'Shortcuts', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('shortcut_set_switch', 1), - 'access callback' => 'shortcut_set_switch_access', - 'access arguments' => array(1), + 'route_name' => 'shortcut.overview', 'type' => MENU_LOCAL_TASK, - 'file' => 'shortcut.admin.inc', ); return $items; diff --git a/core/modules/shortcut/shortcut.routing.yml b/core/modules/shortcut/shortcut.routing.yml index 3408ea1..15549fd 100644 --- a/core/modules/shortcut/shortcut.routing.yml +++ b/core/modules/shortcut/shortcut.routing.yml @@ -3,7 +3,7 @@ shortcut.link_delete: defaults: _form: 'Drupal\shortcut\Form\LinkDelete' requirements: - _access_shortcut_link_delete: 'TRUE' + _access_shortcut_link: 'TRUE' shortcut.set_delete: path: '/admin/config/user-interface/shortcut/manage/{shortcut_set}/delete' @@ -47,3 +47,28 @@ shortcut.set_customize: _entity_form: 'shortcut_set.customize' requirements: _entity_access: 'shortcut_set.update' + +shortcut.link_add: + path: '/admin/config/user-interface/shortcut/manage/{shortcut_set}/add-link' + defaults: + _content: '\Drupal\shortcut\Form\ShortcutForm::add' + _title: 'Add Shortcut' + requirements: + _access_shortcut_set_edit: 'TRUE' + +shortcut.link_edit: + path: '/admin/config/user-interface/shortcut/link/{menu_link}' + defaults: + _content: '\Drupal\shortcut\Form\ShortcutForm::edit' + _title: 'Add Shortcut' + requirements: + _access_shortcut_link: 'TRUE' + +shortcut.overview: + path: 'user/{user}/shortcuts' + defaults: + _content: '\Drupal\shortcut\Form\ShortcutForm::overview' + _title: 'Shortcuts' + requirements: + _access_shortcut_set_switch: 'TRUE' + diff --git a/core/modules/shortcut/shortcut.services.yml b/core/modules/shortcut/shortcut.services.yml index bb95f49..439a0e0 100644 --- a/core/modules/shortcut/shortcut.services.yml +++ b/core/modules/shortcut/shortcut.services.yml @@ -1,5 +1,15 @@ services: access_check.shortcut.link: - class: Drupal\shortcut\Access\LinkDeleteAccessCheck + class: Drupal\shortcut\Access\LinkAccessCheck + tags: + - { name: access_check } + + access_check.shortcut.shortcut_set_edit: + class: Drupal\shortcut\Access\ShortcutSetEditAccessCheck + tags: + - { name: access_check } + + access_check.shortcut.shortcut_set_switch: + class: Drupal\shortcut\Access\ShortcutSetSwitchAccessCheck tags: - { name: access_check } diff --git a/core/modules/system/lib/Drupal/system/Form/SystemForm.php b/core/modules/system/lib/Drupal/system/Form/SystemForm.php new file mode 100644 index 0000000..20b64db --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Form/SystemForm.php @@ -0,0 +1,24 @@ + 'Localize date formats', + 'route_name' => 'system.localize_date_format', 'description' => 'Configure date formats for each locale', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('system_date_format_localize_form', 5), - 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/config/regional/date-time/locale/%/reset'] = array( 'title' => 'Reset date formats', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index bef9a05..7b284ae 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -351,3 +351,11 @@ system.batch_page: _controller: '\Drupal\system\Controller\BatchController::batchPage' requirements: _access: 'TRUE' + +system.localize_date_format: + path: '/admin/config/regional/date-time/locale/{langcode}/edit' + defaults: + _content: '\Drupal\system\Form\SystemForm::localizeDateFormat' + _title: 'Localize date formats' + requirements: + _permission: 'administer site configuration' diff --git a/core/modules/update/lib/Drupal/update/Access/UpdateManagerAccessCheck.php b/core/modules/update/lib/Drupal/update/Access/UpdateManagerAccessCheck.php new file mode 100644 index 0000000..adc04c8 --- /dev/null +++ b/core/modules/update/lib/Drupal/update/Access/UpdateManagerAccessCheck.php @@ -0,0 +1,51 @@ +settings = $settings; + } + + /** + * {@inheritdoc} + */ + public function appliesTo() { + return array('_access_update_manager'); + } + + /** + * {@inheritdoc} + */ + public function access(Route $route, Request $request) { + return $this->settings->get('allow_authorize_operations', TRUE) ? static::ALLOW : static::DENY; + } + +} diff --git a/core/modules/update/lib/Drupal/update/Form/UpdateForm.php b/core/modules/update/lib/Drupal/update/Form/UpdateForm.php new file mode 100644 index 0000000..b904633 --- /dev/null +++ b/core/modules/update/lib/Drupal/update/Form/UpdateForm.php @@ -0,0 +1,84 @@ + $path) { $items[$path . '/install'] = array( - 'page callback' => 'drupal_get_form', - 'page arguments' => array('update_manager_install_form', $context), - 'access callback' => 'update_manager_access', - 'access arguments' => array(), + 'route_name' => "update.{$context}_install", 'weight' => 25, 'type' => MENU_LOCAL_ACTION, - 'file' => 'update.manager.inc', ); $items[$path . '/update'] = array( - 'page callback' => 'drupal_get_form', - 'page arguments' => array('update_manager_update_form', $context), - 'access callback' => 'update_manager_access', - 'access arguments' => array(), + 'route_name' => "update.{$context}_update", 'weight' => 10, 'title' => 'Update', 'type' => MENU_LOCAL_TASK, - 'file' => 'update.manager.inc', ); } // Customize the titles of the action links depending on where they appear. @@ -212,18 +204,6 @@ function update_menu() { $items['admin/modules/install'] += array('title' => 'Install new module'); $items['admin/appearance/install'] += array('title' => 'Install new theme'); - // Menu callback used for the confirmation page after all the releases - // have been downloaded, asking you to backup before installing updates. - $items['admin/update/ready'] = array( - 'title' => 'Ready to update', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('update_manager_update_ready_form'), - 'access callback' => 'update_manager_access', - 'access arguments' => array(), - 'type' => MENU_CALLBACK, - 'file' => 'update.manager.inc', - ); - return $items; } diff --git a/core/modules/update/update.routing.yml b/core/modules/update/update.routing.yml index 43ae6b5..fcfbdd1 100644 --- a/core/modules/update/update.routing.yml +++ b/core/modules/update/update.routing.yml @@ -19,3 +19,77 @@ update.manual_status: _content: '\Drupal\update\Controller\UpdateController::updateStatusManually' requirements: _permission: 'administer site configuration' + +update.report_install: + path: '/admin/reports/updates/install' + defaults: + _content: '\Drupal\update\Form\UpdateForm::reportInstall' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.report_update: + path: '/admin/reports/updates/update' + defaults: + _content: '\Drupal\update\Form\UpdateForm::reportUpdate' + _title: 'Update' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.module_install: + path: '/admin/modules/install' + defaults: + _content: '\Drupal\update\Form\UpdateForm::moduleInstall' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.module_update: + path: '/admin/modules/update' + defaults: + _content: '\Drupal\update\Form\UpdateForm::moduleUpdate' + _title: 'Update' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.theme_install: + path: '/admin/theme/install' + defaults: + _content: '\Drupal\update\Form\UpdateForm::themeInstall' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.theme_update: + path: '/admin/theme/update' + defaults: + _content: '\Drupal\update\Form\UpdateForm::themeUpdate' + _title: 'Update' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' + +update.confirmation_page: + path: '/admin/update/ready' + defaults: + _content: '\Drupal\update\Form\UpdateForm::confirmUpdates' + _title: 'Ready to update' + options: + _access_mode: 'ALL' + requirements: + _permission: 'administer software updates' + _access_update_manager: 'TRUE' diff --git a/core/modules/update/update.services.yml b/core/modules/update/update.services.yml new file mode 100644 index 0000000..0ffafc2 --- /dev/null +++ b/core/modules/update/update.services.yml @@ -0,0 +1,6 @@ +services: + access_check.update.manager_access: + class: Drupal\update\Access\UpdateManagerAccessCheck + arguments: ['@settings'] + tags: + - { name: access_check } diff --git a/core/modules/user/lib/Drupal/user/Form/UserForm.php b/core/modules/user/lib/Drupal/user/Form/UserForm.php new file mode 100644 index 0000000..49c8c76 --- /dev/null +++ b/core/modules/user/lib/Drupal/user/Form/UserForm.php @@ -0,0 +1,24 @@ + 'user.pass', 'type' => MENU_LOCAL_TASK, ); + // Since menu_get_ancestors() does not support multiple placeholders in a row, + // this MENU_CALLBACK cannot be removed yet. $items['user/reset/%/%/%'] = array( 'title' => 'Reset password', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('user_pass_reset', 2, 3, 4), - 'access callback' => TRUE, + 'route_name' => 'user.reset', 'type' => MENU_CALLBACK, - 'file' => 'user.pages.inc', ); $items['user/logout'] = array( diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 6d59e6c..2977253 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -13,6 +13,8 @@ /** * Menu callback; process one time login link and redirects to the user page on success. + * + * @deprecated Use \Drupal\user\Form\UserForm::resetPass() */ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $action = NULL) { global $user; diff --git a/core/modules/user/user.routing.yml b/core/modules/user/user.routing.yml index 6a9c057..7de3b7f 100644 --- a/core/modules/user/user.routing.yml +++ b/core/modules/user/user.routing.yml @@ -150,3 +150,12 @@ user.cancel_confirm: hashed_pass: '' requirements: _entity_access: 'user.delete' + +user.reset: + path: '/user/reset/{uid}/{timestamp}/{hash}/{operation}' + defaults: + _content: '\Drupal\user\Form\UserForm::resetPass' + _title: 'Reset password' + operation: NULL + requirements: + _access: 'TRUE'