diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponse.php b/core/lib/Drupal/Core/Ajax/AjaxResponse.php index ccd7ce3..cb30215 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxResponse.php +++ b/core/lib/Drupal/Core/Ajax/AjaxResponse.php @@ -113,7 +113,15 @@ protected function ajaxRender(Request $request) { // Make sure that drupal_get_js() returns settings by injecting an empty // setting. - $items['js']['settings'] = array('data' => array(), 'scope' => 'header'); + $items['js']['settings'] = array( + 'type' => 'setting', + 'scope' => 'header', + 'group' => JS_SETTING, + 'every_page' => TRUE, + 'weight' => 0, + 'browsers' => array(), + 'data' => array(), + ); $styles = drupal_get_css($items['css'], TRUE); $scripts_footer = drupal_get_js('footer', $items['js'], TRUE); $scripts_header = drupal_get_js('header', $items['js'], TRUE); diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index b3b3fff..5b7ee52 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -624,7 +624,7 @@ function menu_form_node_form_alter(&$form, $form_state) { ); // Get the needed range in menu so the weight selector is sized appropriately. - $delta = entity_get_controller('menu_link')->menuLinksRange($link->menu_name); + $delta = entity_get_controller('menu_link')->menuLinksSize($link->menu_name) + 1; if ($delta < 50) { // Old hardcoded value $delta = 50; diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php index f6e2778..cd0f7c5 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php @@ -582,8 +582,8 @@ public function countMenuLinks($menu_name) { /** * Returns the maximum size in weights for a given menu. * - * So for example you there is a menu with a link with weight -5 and one with - * 4, it should return "5". + * So for example there is a menu with a link with weight -5 and one with 4, + * it should return "5". * * @param string $menu_name * The unique name of a menu. diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php index 32aea71..07991ec 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/DialogTest.php @@ -60,7 +60,7 @@ function testDialog() { // Emulate going to the JS version of the page and check the JSON response. $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-contents/ajax/1'); - $this->assertEqual($modal_expected_response, $ajax_result[1], 'Modal dialog JSON response matches.'); + $this->assertEqual($modal_expected_response, end($ajax_result), 'Modal dialog JSON response matches.'); // Check that requesting a "normal" dialog without JS goes to a page. $this->drupalGet('ajax-test/dialog-contents/nojs'); @@ -68,12 +68,13 @@ function testDialog() { // Emulate going to the JS version of the page and check the JSON response. $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-contents/ajax'); - $this->assertEqual($normal_expected_response, $ajax_result[1], 'Normal dialog JSON response matches.'); + $this->assertEqual($normal_expected_response, end($ajax_result), 'Normal dialog JSON response matches.'); // Emulate closing the dialog via an AJAX request. There is no non-JS // version of this test. $ajax_result = $this->drupalGetAJAX('ajax-test/dialog-close'); - $this->assertEqual($close_expected_response, $ajax_result[0], 'Close dialog JSON response matches.'); + debug($ajax_result); + $this->assertEqual($close_expected_response, end($ajax_result), 'Close dialog JSON response matches.'); // Test submitting via a POST request through the button for modals. This // approach more accurately reflects the real responses by Drupal because