Commit ca35085f authored by alexpott's avatar alexpott

Issue #2312647 by iMiksu, olli, longwave, Jalandhar: views_ajax_render() has been removed

parent 268c4f20
......@@ -62,7 +62,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
);
$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();
......
......@@ -69,7 +69,10 @@ public function buildForm(array $form, FormStateInterface $form_state, Request $
);
$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) {
......
......@@ -64,7 +64,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
),
);
$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) {
......
......@@ -66,7 +66,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
);
$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();
......
......@@ -64,7 +64,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$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(
......
......@@ -56,7 +56,10 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$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';
......
......@@ -42,7 +42,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$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']) . ': ';
......
......@@ -70,6 +70,10 @@ public function testMachineNameOption() {
$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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment