Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Controller/Component/SearchComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class SearchComponent extends Component
'operator' => 'LIKE',
'attributes' => [
'label' => false,
'type' => 'text',
'placeholder' => null,
],
'options' => false
Expand Down
6 changes: 3 additions & 3 deletions src/View/Helper/SearchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public function filterForm($filters = [], $options = [])
foreach ($filters as $field) {
// if field is select-box because of the options-key
if ($field['options']) {
$html .= $this->Form->select($field['column'], $field['options'], $field['attributes']);
} else {
$html .= $this->Form->input($field['column'], $field['attributes']);
$field['attributes']['options'] = $field['options'];
}
$html .= $this->Form->input($field['column'], $field['attributes']);
$html .= ' ';
}

// end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public function testAddFilter()
'operator' => 'LIKE',
'attributes' => [
'label' => false,
'type' => 'text',
'placeholder' => null
],
'options' => false
Expand Down
4 changes: 1 addition & 3 deletions tests/TestCase/View/Helper/SearchHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function setUp()
'operator' => 'LIKE',
'attributes' => [
'label' => false,
'type' => 'text',
'placeholder' => 'title'
],
'options' => false
Expand All @@ -55,7 +54,6 @@ public function setUp()
'operator' => '=',
'attributes' => [
'label' => false,
'type' => 'text',
'placeholder' => 'category',
'empty' => true
],
Expand Down Expand Up @@ -88,7 +86,7 @@ public function testFilterForm()

$this->assertContains('<form method="get" accept-charset="utf-8" action="/">', $result);
$this->assertContains('<input type="text" name="title" placeholder="title" id="title"/>', $result);
$this->assertContains('<select name="category" placeholder="category">', $result);
$this->assertContains('<select name="category" placeholder="category" id="category">', $result);
$this->assertContains('<option value=""></option>', $result);
$this->assertContains('<option value="1">category 1</option>', $result);
$this->assertContains('<option value="2">category 2</option>', $result);
Expand Down