Completed
Push — develop ( 0bfa91...da5abe )
by
unknown
08:59 queued 15s
created

AtsModeFieldset::getHydrator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Jobs\Form;
12
13
use Core\Entity\Hydrator\EntityHydrator;
14
use Core\Form\ViewPartialProviderInterface;
15
use Jobs\Entity\AtsModeInterface;
16
use Zend\Form\Fieldset;
17
use Zend\InputFilter\InputFilterProviderInterface;
18
19
/**
20
 * Base Fieldset for \Jobs\Form\AtsMode
21
 *
22
 * @author Mathias Gelhausen <[email protected]>
23
 * @since 0.19
24
 */
25
class AtsModeFieldset extends Fieldset implements ViewPartialProviderInterface, InputFilterProviderInterface
26
{
27
28
    /**
29
     * View partial name
30
     *
31
     * @var string
32
     */
33
    protected $partial = 'jobs/form/ats-mode';
34
35
    public function setViewPartial($partial)
36
    {
37
        $this->partial = $partial;
38
39
        return $this;
40
    }
41
42
    public function getViewPartial()
43
    {
44
        return $this->partial;
45
    }
46
47
    public function getHydrator()
48
    {
49
        if (!$this->hydrator) {
50
            $hydrator = new EntityHydrator();
51
            $this->setHydrator($hydrator);
52
        }
53
        return $this->hydrator;
54
    }
55
56
    public function allowObjectBinding($object)
57
    {
58
        return $object instanceof AtsModeInterface || parent::allowObjectBinding($object);
59
    }
60
61
62
    public function init()
63
    {
64
        $this->setName('atsMode');
65
        $this->add(
66
            array(
67
            'type' => 'Select',
68
            'name' => 'mode',
69
            'options' => array(
70
                'label' => /*@translate*/ 'Mode',
71
                'value_options' => array(
72
                    'intern' => /*@translate*/ 'Built-In ATS',
73
                    'uri'    => /*@translate*/ 'Use external link',
74
                    'email'  => /*@translate*/ 'Get applications via email',
75
                    'none'   => /*@translate*/ 'Do not track',
76
                ),
77
            ),
78
            'attributes' => array(
79
                'data-searchbox' => 'false',
80
                'value' => 'email',
81
            )
82
            )
83
        );
84
85
        $this->add(
86
            array(
87
            'type' => 'Text',
88
            'name' => 'uri',
89
            'options' => array(
90
                'label' => /*@translate*/ 'URL',
91
            )
92
            )
93
        );
94
95
        $this->add(
96
            array(
97
            'type' => 'Text',
98
            'name' => 'email',
99
            'options' => array(
100
                'label' => /*@translate*/ 'Email',
101
            ),
102
            )
103
        );
104
        
105
        $this->add([
106
            'type' => 'Checkbox',
107
            'name' => 'oneClickApply',
108
            'options' => [
109
                'label' => /*@translate*/ 'One click apply',
110
            ]
111
        ]);
112
        
113
        $this->add([
114
            'type' => 'Select',
115
            'name' => 'oneClickApplyProfiles',
116
            'options' => [
117
                'label' => /*@translate*/ 'Social profiles',
118
                'value_options' => [
119
                    'facebook' => 'Facebook',
120
                    'xing'     => 'Xing',
121
                    'linkedin' => 'LinkedIn'
122
                ],
123
                'use_hidden_element' => true
124
            ],
125
            'attributes' => [
126
                'multiple' => true
127
            ]
128
        ]);
129
    }
130
131
    /**
132
     * Returns the input filter specification.
133
     *
134
     * @internal
135
     *  Only specifies type to get the input filter from the plugin manager via its
136
     *  factory.
137
     *
138
     * @return array
139
     */
140
    public function getInputFilterSpecification()
141
    {
142
        return array(
143
            'type' => 'Jobs/AtsMode',
144
        );
145
    }
146
}
147