diff --git a/core/includes/menu.inc b/core/includes/menu.inc index bf94563..a58a674 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -13,7 +13,6 @@ use Drupal\menu_link\MenuLinkStorageController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Route; /** * @defgroup menu Menu system @@ -779,7 +778,17 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) { if (!empty($router_item['route_name'])) { $route_provider = Drupal::getContainer()->get('router.route_provider'); $route = $route_provider->getRouteByName($router_item['route_name']); - $router_item['access'] = menu_item_route_access($route, $router_item['href']); + $request = Request::create('/' . $router_item['href']); + $request->attributes->set('system_path', $router_item['href']); + // Attempt to match this path to provide a fully built request to the + // acccess checker. + try { + $request->attributes->add(Drupal::service('router.dynamic')->matchRequest($request)); + $router_item['access'] = Drupal::service('access_manager')->check($route, $request); + } + catch (NotFoundHttpException $e) { + $router_item['access'] = FALSE; + } } else { // @todo: Remove once all routes are converted. @@ -917,7 +926,8 @@ function _menu_link_translate(&$item, $translate = FALSE) { // menu_tree_check_access() may set this ahead of time for links to nodes. if (!isset($item['access'])) { if ($route = $item->getRoute()) { - $item['access'] = menu_item_route_access($route, $item['href']); + $request = Request::create('/' . $item['path']); + $item['access'] = drupal_container()->get('access_manager')->check($route, $request); } elseif (!empty($item['load_functions']) && !_menu_load_objects($item, $map)) { // An error occurred loading an object. @@ -947,32 +957,6 @@ function _menu_link_translate(&$item, $translate = FALSE) { } /** - * Checks access to a menu item by mocking a request for a path. - * - * @param \Symfony\Component\Routing\Route $route - * Router for the given menu item. - * @param string $href - * Menu path as returned by $item['href'] of menu_get_item(). - * - * @return bool - * TRUE if the user has access or FALSE if the user should be presented - * with access denied. - */ -function menu_item_route_access(Route $route, $href) { - $request = Request::create('/' . $href); - $request->attributes->set('system_path', $href); - // Attempt to match this path to provide a fully built request to the - // access checker. - try { - $request->attributes->add(Drupal::service('router.dynamic')->matchRequest($request)); - return Drupal::service('access_manager')->check($route, $request); - } - catch (NotFoundHttpException $e) { - return FALSE; - } -} - -/** * Gets a loaded object from a router item. * * menu_get_object() provides access to objects loaded by the current router diff --git a/core/lib/Drupal/Core/Controller/DialogController.php b/core/lib/Drupal/Core/Controller/DialogController.php index 440fb15..4b26686 100644 --- a/core/lib/Drupal/Core/Controller/DialogController.php +++ b/core/lib/Drupal/Core/Controller/DialogController.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Controller\DialogController. + * Contains \Drupal\core\Controller\DialogController. */ -namespace Drupal\Core\Controller; +namespace Drupal\core\Controller; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\OpenDialogCommand; diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 34d0905..bf1b10c 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -5,8 +5,6 @@ * Controls the visual building blocks a page is constructed with. */ -use Drupal\Component\Plugin\Exception\PluginException; - /** * Denotes that a block is not enabled in any region and should not be shown. */ @@ -310,7 +308,7 @@ function _block_get_renderable_region($list = array()) { // to other users. We therefore exclude user 1 from block caching. $not_cacheable = $GLOBALS['user']->uid == 1 || count(module_implements('node_grants')) || - !in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')); + !\Drupal::request()->isMethodSafe(); foreach ($list as $key => $block) { $settings = $block->get('settings'); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php index 405fabd..2457d97 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php @@ -207,9 +207,10 @@ public function save(array $form, array &$form_state) { */ public function delete(array $form, array &$form_state) { $destination = array(); - if (isset($_GET['destination'])) { + $query = \Drupal::request()->query; + if (!is_null($query->get('destination'))) { $destination = drupal_get_destination(); - unset($_GET['destination']); + $query->remove('destination'); } $block = $this->buildEntity($form, $form_state); $form_state['redirect'] = array('block/' . $block->id() . '/delete', array('query' => $destination)); diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 61e3701..36e0eab 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -875,9 +875,10 @@ function book_node_prepare(EntityInterface $node) { if (empty($node->book) && (user_access('add content to books') || user_access('administer book outlines'))) { $node->book = array(); - if (empty($node->nid) && isset($_GET['parent']) && is_numeric($_GET['parent'])) { + $query = \Drupal::request()->query; + if (empty($node->nid) && !is_null($query->get('parent')) && is_numeric($query->get('parent'))) { // Handle "Add child page" links: - $parent = book_link_load($_GET['parent']); + $parent = book_link_load($query->get('parent')); if ($parent && $parent['access']) { $node->book['bid'] = $parent['bid']; diff --git a/core/modules/breakpoint/config/breakpoint.settings.yml b/core/modules/breakpoint/config/breakpoint.settings.yml old mode 100644 new mode 100755 diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index 1847a98..b67cb4a 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -98,28 +98,6 @@ function testList() { ); $actual_items = $controller->buildRow($entity); $this->assertIdentical($expected_items, $actual_items, 'Return value from buildRow matches expected.'); - // Test sorting. - $storage_controller = $controller->getStorageController(); - $entity = $storage_controller->create(array( - 'id' => 'alpha', - 'label' => 'Alpha', - 'weight' => 1, - )); - $entity->save(); - $entity = $storage_controller->create(array( - 'id' => 'omega', - 'label' => 'Omega', - 'weight' => 1, - )); - $entity->save(); - $entity = $storage_controller->create(array( - 'id' => 'beta', - 'label' => 'Beta', - 'weight' => 0, - )); - $entity->save(); - $list = $controller->load(); - $this->assertIdentical(array_keys($list), array('beta', 'dotted.default', 'alpha', 'omega')); // Test that config entities that do not support status, do not have // enable/disable operations. @@ -194,11 +172,7 @@ function testListUI() { $this->assertLink('Add test configuration'); $this->clickLink('Add test configuration'); $this->assertResponse(200); - $edit = array( - 'label' => 'Antelope', - 'id' => 'antelope', - 'weight' => 1, - ); + $edit = array('label' => 'Antelope', 'id' => 'antelope'); $this->drupalPost(NULL, $edit, t('Save')); // Ensure that the entity's sort method was called. @@ -211,8 +185,8 @@ function testListUI() { $this->assertFieldByXpath('//td', 'antelope', "Machine name found for added 'Antelope' entity."); // Edit the entity using the operations link. - $this->assertLinkByHref('admin/structure/config_test/manage/antelope/edit'); - $this->clickLink('Edit', 1); + $this->assertLink('Edit'); + $this->clickLink('Edit'); $this->assertResponse(200); $this->assertTitle('Edit Antelope | Drupal'); $edit = array('label' => 'Albatross', 'id' => 'albatross'); @@ -225,8 +199,8 @@ function testListUI() { $this->assertFieldByXpath('//td', 'albatross', "Machine name found for updated 'Albatross' entity."); // Delete the added entity using the operations link. - $this->assertLinkByHref('admin/structure/config_test/manage/albatross/delete'); - $this->clickLink('Delete', 1); + $this->assertLink('Delete'); + $this->clickLink('Delete'); $this->assertResponse(200); $this->assertTitle('Are you sure you want to delete Albatross | Drupal'); $this->drupalPost(NULL, array(), t('Delete')); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php index c2863f7..61c6e47 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php @@ -59,7 +59,6 @@ function testImport() { 'id' => 'new', 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', - 'weight' => '0', 'style' => '', 'status' => '1', 'langcode' => language_default()->langcode, diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php index 0160ee3..9d1e6be 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php @@ -129,7 +129,6 @@ function testNew() { 'id' => 'new', 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', - 'weight' => '0', 'style' => '', 'status' => '1', 'langcode' => language_default()->langcode, diff --git a/core/modules/config/tests/config_test/config/config_test.dynamic.dotted.default.yml b/core/modules/config/tests/config_test/config/config_test.dynamic.dotted.default.yml index 93c3a77..bc52b35 100644 --- a/core/modules/config/tests/config_test/config/config_test.dynamic.dotted.default.yml +++ b/core/modules/config/tests/config_test/config/config_test.dynamic.dotted.default.yml @@ -1,6 +1,5 @@ id: dotted.default label: Default -weight: 0 protected_property: Default # Intentionally commented out to verify default status behavior. # status: 1 diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php index 119774b..efba401 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php @@ -35,11 +35,6 @@ public function form(array $form, array &$form_state) { 'exists' => 'config_test_load', ), ); - $form['weight'] = array( - '#type' => 'weight', - '#title' => 'Weight', - '#default_value' => $entity->get('weight'), - ); $form['style'] = array( '#type' => 'select', '#title' => 'Image style', diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php index 2337a69..2983a44 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigTest.php @@ -59,13 +59,6 @@ class ConfigTest extends ConfigEntityBase { public $label; /** - * The weight of the configuration entity. - * - * @var int - */ - public $weight = 0; - - /** * The image style to use. * * @var string diff --git a/core/modules/edit/js/views/AppView.js b/core/modules/edit/js/views/AppView.js index 6302356..2e617f6 100644 --- a/core/modules/edit/js/views/AppView.js +++ b/core/modules/edit/js/views/AppView.js @@ -267,7 +267,7 @@ Drupal.edit.AppView = Backbone.View.extend({ that.model.set('activeModal', null); // Set the state that matches the user's action. var targetState = (action === 'discard') ? 'candidate' : 'saving'; - that.model.get('activeEditor').set('state', targetState, { confirmed: true }); + that.model.get('activeEditor').set('state', 'candidate', { confirmed: true }); } }); this.model.set('activeModal', modal); diff --git a/core/modules/language/language.module b/core/modules/language/language.module old mode 100644 new mode 100755 diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php b/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php index 6edea17..1136376 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php @@ -7,12 +7,10 @@ namespace Drupal\rest\Plugin\Type; -use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; -use Drupal\Component\Plugin\Factory\ReflectionFactory; use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Core\Plugin\Discovery\AlterDecorator; +use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; -use Drupal\Core\Plugin\Discovery\CacheDecorator; +use Drupal\Component\Plugin\Factory\ReflectionFactory; /** * Manages discovery and instantiation of resource plugins. @@ -28,11 +26,7 @@ class ResourcePluginManager extends PluginManagerBase { */ public function __construct(\Traversable $namespaces) { // Create resource plugin derivatives from declaratively defined resources. - $this->discovery = new AnnotatedClassDiscovery('rest/resource', $namespaces); - $this->discovery = new DerivativeDiscoveryDecorator($this->discovery); - $this->discovery = new AlterDecorator($this->discovery, 'rest_resource'); - $this->discovery = new CacheDecorator($this->discovery, 'rest'); - + $this->discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('rest/resource', $namespaces)); $this->factory = new ReflectionFactory($this->discovery); } diff --git a/core/modules/rest/rest.api.php b/core/modules/rest/rest.api.php deleted file mode 100644 index 0e94098..0000000 --- a/core/modules/rest/rest.api.php +++ /dev/null @@ -1,33 +0,0 @@ -routes; + } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 54ae84b..3832720 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1383,7 +1383,7 @@ function system_library_info() { 'title' => 'Drupal tabbing manager', 'version' => VERSION, 'js' => array( - 'core/misc/tabbingmanager.js' => array('group' => JS_LIBRARY), + 'core/misc/tabbingmanager.js' => array('group', JS_LIBRARY), ), 'dependencies' => array( array('system', 'jquery'), @@ -2658,7 +2658,7 @@ function system_preprocess_block(&$variables) { break; case 'system_menu_block': $variables['attributes']['role'] = 'navigation'; - $variables['attributes']['class'][] = 'block-menu'; + $variables['attributes']['classes'][] = 'block-menu'; } } diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module index 63973aa..e273584 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -1781,6 +1781,7 @@ function _form_test_disabled_elements($form, &$form_state) { $form['color'] = array( '#type' => 'color', '#title' => 'color', + '#disabled' => TRUE, '#default_value' => '#0000ff', '#test_hijack_value' => '#ff0000', '#disabled' => TRUE, diff --git a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php index b58f488..769efdd 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php @@ -81,10 +81,6 @@ public function testViewsGetHandler() { $handler = views_get_handler($item, 'filter', 'standard'); $this->assertTrue($handler instanceof Standard); - // @todo Reinstate these tests when the debug() in views_get_handler() is - // restored. - return; - // Test non-existent tables/fields. set_error_handler(array($this, 'customErrorHandler')); $item = array( diff --git a/core/modules/views/views.module b/core/modules/views/views.module index fca13cd..cf577bf 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -872,7 +872,7 @@ function views_get_handler($item, $type, $override = NULL) { } if (!$optional) { - //debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $type))); + debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $type))); } // Finally, use the 'broken' handler.