Passed
Pull Request — master (#600)
by Mathias
13:24
created

FeaturedCompaniesSearchForm::init()   A

Complexity

Conditions 6
Paths 1

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 21
rs 9.2222
cc 6
nc 1
nop 0
1
<?php
2
3
/**
4
 * YAWIK
5
 *
6
 * @see       https://github.com/cross-solution/YAWIK for the canonical source repository
7
 * @copyright https://github.com/cross-solution/YAWIK/blob/master/COPYRIGHT
8
 * @license   https://github.com/cross-solution/YAWIK/blob/master/LICENSE
9
 */
10
11
declare(strict_types=1);
12
13
namespace Organizations\Form;
14
15
use Core\Form\SearchForm;
16
use Organizations\Form\Element\FeaturedCompaniesFilterRadio;
17
18
/**
19
 * TODO: description
20
 *
21
 * @author Mathias Gelhausen
22
 * TODO: write tests
23
 */
24
class FeaturedCompaniesSearchForm extends SearchForm
25
{
26
27
    public function init()
28
    {
29
        $this->setName($this->getOption('name') ?: 'searchform');
30
31
        $this->addTextElement(
32
            $this->getOption('text_name') ?: 'q',
33
            $this->getOption('text_label') ?: /*@translate*/ 'Search',
34
            $this->getOption('text_placeholder') ?: /*@translate*/ 'Search query',
35
            $this->getOption('text_span') ?: 12,
36
            50,
37
            true
38
        );
39
40
        $this->add([
41
            'type' => FeaturedCompaniesFilterRadio::class
42
        ]);
43
44
        $this->addButton(/*@translate*/ 'Search', -1000, 'submit');
45
        $this->addButton(/*@translate*/ 'Clear', -1001, 'reset');
46
47
        $this->addElements();
48
    }
49
}
50