summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-02-27 12:43:19 (GMT)
committerAlex Pott2015-02-27 12:43:19 (GMT)
commitca35085f8a877c1372204f33de1273a66cd88a26 (patch)
tree91ea7e982850ca9e091d4125d65adcd70d1a2f3e
parent268c4f209ee81f0a8487c33f3a29bfce6cccb3cc (diff)
Issue #2312647 by iMiksu, olli, longwave, Jalandhar: views_ajax_render() has been removed
-rw-r--r--core/modules/views_ui/src/Form/Ajax/AddHandler.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandler.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php3
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Display.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/Rearrange.php5
-rw-r--r--core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php3
-rw-r--r--core/modules/views_ui/src/Tests/ViewEditTest.php4
8 files changed, 28 insertions, 7 deletions
diff --git a/core/modules/views_ui/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
index 02d6e30..8cc2e8c 100644
--- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
@@ -62,7 +62,10 @@ class AddHandler extends ViewsFormBase {
);
$executable = $view->getExecutable();
- $executable->setDisplay($display_id);
+ if (!$executable->setDisplay($display_id)) {
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
+ }
$display = &$executable->displayHandlers->get($display_id);
$types = ViewExecutable::getHandlerTypes();
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
index 4b76fd7..28a7323 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
@@ -69,7 +69,10 @@ class ConfigHandler extends ViewsFormBase {
);
$executable = $view->getExecutable();
$save_ui_cache = FALSE;
- $executable->setDisplay($display_id);
+ if (!$executable->setDisplay($display_id)) {
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
+ }
$item = $executable->getHandler($display_id, $type, $id);
if ($item) {
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
index 6ae42d0..2b784d5 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
@@ -64,7 +64,10 @@ class ConfigHandlerExtra extends ViewsFormBase {
),
);
$executable = $view->getExecutable();
- $executable->setDisplay($display_id);
+ if (!$executable->setDisplay($display_id)) {
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
+ }
$item = $executable->getHandler($display_id, $type, $id);
if ($item) {
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php
index db3d510..e06e210 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php
@@ -66,7 +66,8 @@ class ConfigHandlerGroup extends ViewsFormBase {
);
$executable = $view->getExecutable();
if (!$executable->setDisplay($display_id)) {
- views_ajax_render($this->t('Invalid display id @display', array('@display' => $display_id)));
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
}
$executable->initQuery();
diff --git a/core/modules/views_ui/src/Form/Ajax/Display.php b/core/modules/views_ui/src/Form/Ajax/Display.php
index 5f1aed6..836cec7 100644
--- a/core/modules/views_ui/src/Form/Ajax/Display.php
+++ b/core/modules/views_ui/src/Form/Ajax/Display.php
@@ -64,7 +64,10 @@ class Display extends ViewsFormBase {
$display_id = $form_state->get('display_id');
$executable = $view->getExecutable();
- $executable->setDisplay($display_id);
+ if (!$executable->setDisplay($display_id)) {
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
+ }
// Get form from the handler.
$form['options'] = array(
diff --git a/core/modules/views_ui/src/Form/Ajax/Rearrange.php b/core/modules/views_ui/src/Form/Ajax/Rearrange.php
index 2369d93..fcefb28 100644
--- a/core/modules/views_ui/src/Form/Ajax/Rearrange.php
+++ b/core/modules/views_ui/src/Form/Ajax/Rearrange.php
@@ -56,7 +56,10 @@ class Rearrange extends ViewsFormBase {
$types = ViewExecutable::getHandlerTypes();
$executable = $view->getExecutable();
- $executable->setDisplay($display_id);
+ if (!$executable->setDisplay($display_id)) {
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
+ }
$display = &$executable->displayHandlers->get($display_id);
$form['#title'] = $this->t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
$form['#section'] = $display_id . 'rearrange-item';
diff --git a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
index 58f869a..3ae2d31 100644
--- a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
+++ b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
@@ -42,7 +42,8 @@ class RearrangeFilter extends ViewsFormBase {
$types = ViewExecutable::getHandlerTypes();
$executable = $view->getExecutable();
if (!$executable->setDisplay($display_id)) {
- views_ajax_render($this->t('Invalid display id @display', array('@display' => $display_id)));
+ $form['markup'] = array('#markup' => $this->t('Invalid display id @display', array('@display' => $display_id)));
+ return $form;
}
$display = $executable->displayHandlers->get($display_id);
$form['#title'] = String::checkPlain($display->display['display_title']) . ': ';
diff --git a/core/modules/views_ui/src/Tests/ViewEditTest.php b/core/modules/views_ui/src/Tests/ViewEditTest.php
index 9048972..9025123 100644
--- a/core/modules/views_ui/src/Tests/ViewEditTest.php
+++ b/core/modules/views_ui/src/Tests/ViewEditTest.php
@@ -70,6 +70,10 @@ class ViewEditTest extends UITestBase {
$machine_name_edit_url = 'admin/structure/views/nojs/display/test_view/test_1/display_id';
$error_text = t('Display name must be letters, numbers, or underscores only.');
+ // Test that potential invalid display ID requests are detected
+ $this->drupalGet('admin/structure/views/ajax/handler/test_view/fake_display_name/filter/title');
+ $this->assertText('Invalid display id fake_display_name');
+
$edit = array('display_id' => 'test 1');
$this->drupalPostForm($machine_name_edit_url, $edit, 'Apply');
$this->assertText($error_text);