Completed
Branch BUG-11107-submit-button-text (9a9413)
by
unknown
31:37 queued 21:44
created

EE_Button_Input::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 1
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
/**
3
 * EE_Button_Input
4
 * Similar to EE_Submit_Input, but renders a button element, and its text being displayed
5
 * can differ from the value, and it can contain HTML.
6
 * @package			Event Espresso
7
 * @subpackage
8
 * @author				Mike Nelson
9
 *
10
 */
11
class EE_Button_Input extends EE_Form_Input_Base{
12
13
    /**
14
     * @var string of HTML to put between the button tags
15
     */
16
    protected $_button_content;
17
	/**
18
	 * @param array $options
19
	 */
20 View Code Duplication
	public function __construct($options = array()){
21
	    if( empty($options['button_content'])) {
22
	        $options['button_content'] = esc_html__('Button', 'event_espresso');
23
        }
24
		$this->_set_display_strategy(new EE_Button_Display_Strategy());
25
		$this->_set_normalization_strategy(new EE_Text_Normalization());
26
		$this->_add_validation_strategy( new EE_Plaintext_Validation_Strategy() );
27
		parent::__construct($options);
28
	}
29
30
31
32
    /**
33
     * Sets the button content
34
     * @see EE_Button_Input::$_button_content
35
     * @param string $new_content
36
     */
37
	public function set_button_content($new_content)
38
    {
39
	    $this->_button_content = $new_content;
40
    }
41
    
42
    /**
43
     * Gets the button content
44
     * @return string
45
     */
46
	public function button_content()
47
    {
48
        return $this->_button_content;
49
    }
50
}
51