Skip to content
Snippets Groups Projects
Commit 9aa1f5b9 authored by Nia Kathoni's avatar Nia Kathoni Committed by Daniel Cothran
Browse files

Issue #3500045 by nikathone: Text filter is hiding everything when no value is passed

parent 56d64e28
No related branches found
No related tags found
1 merge request!23Resolve #3500045 "Text filter is"
Pipeline #398899 passed with warnings
......@@ -18,6 +18,19 @@ views.filter.views_csv_source_filter:
key:
type: string
label: 'Column name key'
expose:
type: mapping
label: 'Exposed'
mapping:
required:
type: boolean
label: 'Required'
placeholder:
type: label
label: 'Placeholder'
value:
type: string
label: 'Value'
views.filter.views_csv_source_filter_select:
type: views_filter
......
......@@ -18,6 +18,47 @@ class ViewsCsvFilter extends FilterPluginBase {
use ColumnSelectorTrait;
use ViewsCsvFilterTrait;
/**
* Exposed filter options.
*
* @var bool
*/
protected $alwaysMultiple = TRUE;
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['expose']['contains']['required'] = ['default' => FALSE];
$options['expose']['contains']['placeholder'] = ['default' => ''];
return $options;
}
/**
* {@inheritdoc}
*/
public function defaultExposeOptions() {
parent::defaultExposeOptions();
$this->options['expose']['placeholder'] = NULL;
}
/**
* {@inheritdoc}
*/
public function buildExposeForm(&$form, FormStateInterface $form_state) {
parent::buildExposeForm($form, $form_state);
$form['expose']['placeholder'] = [
'#type' => 'textfield',
'#default_value' => $this->options['expose']['placeholder'],
'#title' => $this->t('Placeholder'),
'#size' => 40,
'#description' => $this->t('Hint text that appears inside the field when empty.'),
];
}
/**
* Operators.
*
......
......@@ -70,6 +70,34 @@ display:
request_body: ''
show_errors: true
header_index: 0
filters:
value:
id: value
table: csv
field: value
relationship: none
group_type: group
admin_label: ''
plugin_id: views_csv_source_filter
operator: '='
value: ''
group: 1
exposed: true
expose:
operator_id: value_op
label: 'Filter by Geography name'
description: ''
use_operator: false
operator: value_op
operator_limit_selection: false
operator_list: {}
identifier: geography_name
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
key: 'Geography name'
page_1:
id: page_1
display_title: 'Page display'
......
......@@ -526,10 +526,10 @@ class SelectTest extends UnitTestCase {
$count = 7;
$header_index_overrides = [
'header_index' => 1,
'csv_file' => $this->retrieveResource('/views_csv_data_with_header_index_moved_test.csv')
'csv_file' => $this->retrieveResource('/views_csv_data_with_header_index_moved_test.csv'),
];
return [
'no_overrides' => [[], $count, 4, []],
'no_overrides' => [[], $count, 4, []],
'header_index_overrides' => [
$header_index_overrides,
$count,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment