Completed
Branch BUG-11107-submit-button-text (879795)
by
unknown
11:38
created

EE_Submit_Input::set_default()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
/**
3
 * EE_Submit_Input
4
 *
5
 * @package			Event Espresso
6
 * @subpackage
7
 * @author				Mike Nelson
8
 *
9
 * This input has a default validation strategy of plaintext (which can be removed after construction)
10
 */
11
class EE_Submit_Input extends EE_Form_Input_Base{
12
13
	/**
14
	 * @param array $options
15
	 */
16
	public function __construct($options = array()){
17
        $options['html_label_text'] = ! empty($options['html_label_text'])
18
            ? $options['html_label_text']
19
            : $options['default'];
20
		$this->_set_display_strategy(new EE_Submit_Input_Display_Strategy());
21
		$this->_set_normalization_strategy(new EE_Text_Normalization());
22
		$this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() );
23
		parent::__construct($options);
24
	}
25
26
27
28
    /**
29
     * Sets the default as normal (overriden so it can circumvent calling
30
     * EE_Submit_Input::_normalize() and EE_Submit_Input::_set_raw_value())
31
     * @param mixed $value
32
     */
33
	public function set_default($value)
34
    {
35
        parent::_set_normalized_value($value);
36
        parent::_set_raw_value($value);
37
    }
38
39
40
41
    /**
42
     * Does nothing, because it's actually not expected for submit input's values to change.
43
     * If you want to change the input's value displayed, use `set_default()`
44
     * @param array $req_data
45
     * @return void
46
     */
47
    public function _normalize($req_data)
48
    {
49
        return;
50
    }
51
52
    /**
53
     * Does nothing, because it's actually not expected for submit input's values to change.
54
     * If you want to change the input's value displayed, use `set_default()`
55
     */
56
    public function _set_raw_value($value)
57
    {
58
        return;
59
    }
60
}
61