Commit fcf51771 authored by larowlan's avatar larowlan

Issue #2987598 by eliclaggett, alexpott, Lendude, Sam152: View's pagination...

Issue #2987598 by eliclaggett, alexpott, Lendude, Sam152: View's pagination doesn't carry the exposed filter value
parent 3b6f89ba
...@@ -183,7 +183,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -183,7 +183,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// https://www.drupal.org/node/342316 is resolved. // https://www.drupal.org/node/342316 is resolved.
$checked = Checkboxes::getCheckedCheckboxes($value); $checked = Checkboxes::getCheckedCheckboxes($value);
foreach ($checked as $option_id) { foreach ($checked as $option_id) {
$view->exposed_raw_input[$key][] = $value[$option_id]; $view->exposed_raw_input[$key][$option_id] = $value[$option_id];
} }
} }
else { else {
......
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
module:
- node
id: test_exposed_form_pager
label: ''
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
core: '8'
display:
default:
display_options:
access:
type: none
cache:
type: tag
exposed_form:
options:
reset_button: true
type: basic
filters:
type:
id: type
table: node_field_data
field: type
relationship: none
group_type: group
admin_label: ''
operator: in
value: { }
group: 1
exposed: true
expose:
operator_id: type_op
label: 'Content: Type'
description: 'Exposed description'
use_operator: false
operator: ''
identifier: type
required: false
remember: false
multiple: true
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: in_operator
entity_type: node
entity_field: type
created:
id: created
table: node_field_data
field: created
relationship: none
group_type: group
admin_label: ''
operator: between
value:
min: ''
max: ''
value: ''
type: offset
group: 1
exposed: true
expose:
operator_id: created_op
label: 'Authored on'
description: ''
use_operator: false
operator: created_op
identifier: created
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
placeholder: ''
min_placeholder: ''
max_placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
entity_type: node
entity_field: created
plugin_id: date
pager:
type: full
options:
items_per_page: 2
offset: 0
id: 0
total_pages: null
tags:
previous: ' Previous'
next: 'Next ›'
first: '« First'
last: 'Last »'
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
quantity: 9
query:
options:
query_comment: ''
type: views_query
style:
type: default
row:
type: 'entity:node'
display_extenders: { }
display_plugin: default
display_title: Master
id: default
position: 0
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
tags: { }
page_1:
display_options:
path: test_exposed_form_pager
display_extenders: { }
display_plugin: page
display_title: Page
id: page_1
position: 0
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
tags: { }
...@@ -24,7 +24,7 @@ class ExposedFormTest extends ViewTestBase { ...@@ -24,7 +24,7 @@ class ExposedFormTest extends ViewTestBase {
* *
* @var array * @var array
*/ */
public static $testViews = ['test_exposed_form_buttons', 'test_exposed_block', 'test_exposed_form_sort_items_per_page']; public static $testViews = ['test_exposed_form_buttons', 'test_exposed_block', 'test_exposed_form_sort_items_per_page', 'test_exposed_form_pager'];
/** /**
* Modules to enable. * Modules to enable.
...@@ -381,4 +381,32 @@ public function testFormErrorWithExposedForm() { ...@@ -381,4 +381,32 @@ public function testFormErrorWithExposedForm() {
$this->assertRaw('<div class="views-row">', 'Views result shown.'); $this->assertRaw('<div class="views-row">', 'Views result shown.');
} }
/**
* Tests the exposed form with a pager.
*/
public function testExposedFilterPagination() {
$this->drupalCreateContentType(['type' => 'post']);
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this->drupalCreateNode(['type' => 'post']);
}
$this->drupalGet('test_exposed_form_pager');
$this->getSession()->getPage()->fillField('type[]', 'post');
$this->getSession()->getPage()->fillField('created[min]', '-1 month');
$this->getSession()->getPage()->fillField('created[max]', '+1 month');
// Ensure the filters can be applied.
$this->getSession()->getPage()->pressButton('Apply');
$this->assertFieldByName('type[]', 'post');
$this->assertFieldByName('created[min]', '-1 month');
$this->assertFieldByName('created[max]', '+1 month');
// Ensure the filters are still applied after pressing next.
$this->clickLink('Next ›');
$this->assertFieldByName('type[]', 'post');
$this->assertFieldByName('created[min]', '-1 month');
$this->assertFieldByName('created[max]', '+1 month');
}
} }
...@@ -136,7 +136,7 @@ public function testExposedFormRawInput() { ...@@ -136,7 +136,7 @@ public function testExposedFormRawInput() {
$expected = [ $expected = [
'type' => 'All', 'type' => 'All',
'type_with_default_value' => 'article', 'type_with_default_value' => 'article',
'multiple_types_with_default_value' => ['article'], 'multiple_types_with_default_value' => ['article' => 'article'],
]; ];
$this->assertSame($view->exposed_raw_input, $expected); $this->assertSame($view->exposed_raw_input, $expected);
} }
......
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