Issue #2133897 by Wim Leers: Clean up Edit: don't pass AJAX URLs from the server to the client through drupalSettings, use Drupal.url() instead.
parent
8a68d25d9a
commit
64c97584c4
|
@ -59,13 +59,6 @@ function edit_page_build(&$page) {
|
|||
return;
|
||||
}
|
||||
|
||||
$page['#attached']['js'][] = array(
|
||||
'type' => 'setting',
|
||||
'data' => array('edit' => array(
|
||||
'fieldFormURL' => url('edit/form/!entity_type/!id/!field_name/!langcode/!view_mode'),
|
||||
'context' => 'body',
|
||||
)),
|
||||
);
|
||||
$page['#attached']['library'][] = array('edit', 'edit');
|
||||
}
|
||||
|
||||
|
@ -111,6 +104,7 @@ function edit_library_info() {
|
|||
array('system', 'backbone'),
|
||||
array('system', 'jquery.form'),
|
||||
array('system', 'jquery.ui.position'),
|
||||
array('system', 'drupal'),
|
||||
array('system', 'drupal.displace'),
|
||||
array('system', 'drupal.form'),
|
||||
array('system', 'drupal.ajax'),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
* Provides utility functions for Edit.
|
||||
*/
|
||||
(function ($, _, Drupal, drupalSettings) {
|
||||
(function ($, Drupal) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -59,7 +59,7 @@ Drupal.edit.util.form = {
|
|||
|
||||
// Create a Drupal.ajax instance to load the form.
|
||||
var formLoaderAjax = new Drupal.ajax(fieldID, $el, {
|
||||
url: Drupal.edit.util.buildUrl(fieldID, drupalSettings.edit.fieldFormURL),
|
||||
url: Drupal.edit.util.buildUrl(fieldID, Drupal.url('edit/form/!entity_type/!id/!field_name/!langcode/!view_mode')),
|
||||
event: 'edit-internal.edit',
|
||||
submit: {
|
||||
nocssjs : options.nocssjs,
|
||||
|
@ -120,4 +120,4 @@ Drupal.edit.util.form = {
|
|||
}
|
||||
};
|
||||
|
||||
})(jQuery, _, Drupal, drupalSettings);
|
||||
})(jQuery, Drupal);
|
||||
|
|
|
@ -76,9 +76,8 @@ class EditLoadingTest extends WebTestBase {
|
|||
$this->drupalLogin($this->author_user);
|
||||
$this->drupalGet('node/1');
|
||||
|
||||
// Settings, library and in-place editors.
|
||||
// Library and in-place editors.
|
||||
$settings = $this->drupalGetSettings();
|
||||
$this->assertFalse(isset($settings['edit']), 'Edit settings do not exist.');
|
||||
$this->assertFalse(isset($settings['ajaxPageState']['js']['core/modules/edit/js/edit.js']), 'Edit library not loaded.');
|
||||
$this->assertFalse(isset($settings['ajaxPageState']['js']['core/modules/edit/js/createjs/editingWidgets/formwidget.js']), "'form' in-place editor not loaded.");
|
||||
|
||||
|
@ -133,9 +132,8 @@ class EditLoadingTest extends WebTestBase {
|
|||
$this->drupalLogin($this->editor_user);
|
||||
$this->drupalGet('node/1');
|
||||
|
||||
// Settings, library and in-place editors.
|
||||
// Library and in-place editors.
|
||||
$settings = $this->drupalGetSettings();
|
||||
$this->assertTrue(isset($settings['edit']), 'Edit settings exist.');
|
||||
$this->assertTrue(isset($settings['ajaxPageState']['js']['core/modules/edit/js/edit.js']), 'Edit library loaded.');
|
||||
$this->assertFalse(isset($settings['ajaxPageState']['js']['core/modules/edit/js/createjs/editingWidgets/formwidget.js']), "'form' in-place editor not loaded.");
|
||||
|
||||
|
|
Loading…
Reference in New Issue