Issue #2015165 by damiankloip: Exposed forms are not rendered in the Views UI preview.
parent
7b9e229748
commit
07c6057fb3
|
@ -139,13 +139,12 @@ abstract class ExposedFormPluginBase extends PluginBase {
|
||||||
|
|
||||||
$form_state['exposed_form_plugin'] = $this;
|
$form_state['exposed_form_plugin'] = $this;
|
||||||
$form = drupal_build_form('views_exposed_form', $form_state);
|
$form = drupal_build_form('views_exposed_form', $form_state);
|
||||||
$output = drupal_render($form);
|
|
||||||
|
|
||||||
if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) {
|
if (!$this->view->display_handler->displaysExposed() || (!$block && $this->view->display_handler->getOption('exposed_block'))) {
|
||||||
return "";
|
return array();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return $output;
|
return $form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,8 @@ class ExposedFormTest extends ViewTestBase {
|
||||||
$view = views_get_view('test_reset_button');
|
$view = views_get_view('test_reset_button');
|
||||||
$this->executeView($view);
|
$this->executeView($view);
|
||||||
$exposed_form = $view->display_handler->getPlugin('exposed_form');
|
$exposed_form = $view->display_handler->getPlugin('exposed_form');
|
||||||
$this->drupalSetContent($exposed_form->renderExposedForm());
|
$output = $exposed_form->renderExposedForm();
|
||||||
|
$this->drupalSetContent(drupal_render($output));
|
||||||
|
|
||||||
$expected_id = drupal_clean_css_identifier('views-exposed-form-' . $view->storage->id() . '-' . $view->current_display);
|
$expected_id = drupal_clean_css_identifier('views-exposed-form-' . $view->storage->id() . '-' . $view->current_display);
|
||||||
$this->assertFieldByXpath('//form/@id', $expected_id, 'Expected form ID found.');
|
$this->assertFieldByXpath('//form/@id', $expected_id, 'Expected form ID found.');
|
||||||
|
|
|
@ -38,7 +38,33 @@ display:
|
||||||
label: Name
|
label: Name
|
||||||
exclude: '0'
|
exclude: '0'
|
||||||
plugin_id: standard
|
plugin_id: standard
|
||||||
filters: { }
|
filters:
|
||||||
|
id:
|
||||||
|
id: id
|
||||||
|
table: views_test_data
|
||||||
|
field: id
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
operator: '='
|
||||||
|
value:
|
||||||
|
min: ''
|
||||||
|
max: ''
|
||||||
|
value: ''
|
||||||
|
group: '1'
|
||||||
|
exposed: '1'
|
||||||
|
expose:
|
||||||
|
operator_id: id_op
|
||||||
|
label: 'ID'
|
||||||
|
description: ''
|
||||||
|
use_operator: '0'
|
||||||
|
operator: id_op
|
||||||
|
identifier: id
|
||||||
|
required: '0'
|
||||||
|
remember: '0'
|
||||||
|
multiple: '0'
|
||||||
|
is_grouped: '0'
|
||||||
|
plugin_id: numeric
|
||||||
sorts: { }
|
sorts: { }
|
||||||
filter_groups:
|
filter_groups:
|
||||||
operator: AND
|
operator: AND
|
||||||
|
@ -56,6 +82,42 @@ display:
|
||||||
title_enable: '0'
|
title_enable: '0'
|
||||||
title: ''
|
title: ''
|
||||||
plugin_id: numeric
|
plugin_id: numeric
|
||||||
|
header:
|
||||||
|
area_text_custom:
|
||||||
|
id: area_text_custom
|
||||||
|
table: views
|
||||||
|
field: area_text_custom
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
empty: '1'
|
||||||
|
content: 'Test header text'
|
||||||
|
tokenize: '0'
|
||||||
|
plugin_id: text_custom
|
||||||
|
footer:
|
||||||
|
area_text_custom:
|
||||||
|
id: area_text_custom
|
||||||
|
table: views
|
||||||
|
field: area_text_custom
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
empty: '1'
|
||||||
|
content: 'Test footer text'
|
||||||
|
tokenize: '0'
|
||||||
|
plugin_id: text_custom
|
||||||
|
empty:
|
||||||
|
area_text_custom:
|
||||||
|
id: area_text_custom
|
||||||
|
table: views
|
||||||
|
field: area_text_custom
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
empty: '1'
|
||||||
|
content: 'Test empty text'
|
||||||
|
tokenize: '0'
|
||||||
|
plugin_id: text_custom
|
||||||
label: test_preview
|
label: test_preview
|
||||||
module: views
|
module: views
|
||||||
id: test_preview
|
id: test_preview
|
||||||
|
|
|
@ -38,6 +38,14 @@ class PreviewTest extends UITestBase {
|
||||||
|
|
||||||
$elements = $this->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', array(':ul-class' => 'contextual-links', ':li-class' => 'filter-add'));
|
$elements = $this->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', array(':ul-class' => 'contextual-links', ':li-class' => 'filter-add'));
|
||||||
$this->assertEqual(count($elements), 1, 'The contextual link to add a new field is shown.');
|
$this->assertEqual(count($elements), 1, 'The contextual link to add a new field is shown.');
|
||||||
|
|
||||||
|
$this->drupalPost(NULL, $edit = array('view_args' => '100'), t('Update preview'));
|
||||||
|
|
||||||
|
// Test that area text and exposed filters are present and rendered.
|
||||||
|
$this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
|
||||||
|
$this->assertText('Test header text', 'Rendered header text found');
|
||||||
|
$this->assertText('Test footer text', 'Rendered footer text found.');
|
||||||
|
$this->assertText('Test empty text', 'Rendered empty text found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +71,12 @@ class PreviewTest extends UITestBase {
|
||||||
|
|
||||||
$elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
|
$elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
|
||||||
$this->assertEqual(count($elements), 0);
|
$this->assertEqual(count($elements), 0);
|
||||||
|
|
||||||
|
// Test that area text and exposed filters are present and rendered.
|
||||||
|
$this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
|
||||||
|
$this->assertText('Test header text', 'Rendered header text found');
|
||||||
|
$this->assertText('Test footer text', 'Rendered footer text found.');
|
||||||
|
$this->assertText('Test empty text', 'Rendered empty text found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue