1 <?php
2 /**
3 * UIX Controls
4 *
5 * @package controls
6 * @author David Cramer
7 * @license GPL-2.0+
8 * @link
9 * @copyright 2016 David Cramer
10 */
11 namespace uix\ui\control;
12
13 /**
14 * textarea / paragraph input
15 *
16 * @since 1.0.0
17 */
18 class textarea extends \uix\ui\control{
19
20 /**
21 * The type of object
22 *
23 * @since 1.0.0
24 * @access public
25 * @var string
26 */
27 public $type = 'textarea';
28
29 /**
30 * Gets the attributes for the control.
31 *
32 * @since 1.0.0
33 * @access public
34 */
35 public function set_attributes() {
36
37 parent::set_attributes();
38 $this->attributes['rows'] = '5';
39 $this->attributes['class'] = 'widefat';
40
41 if( !empty( $this->struct['rows'] ) )
42 $this->attributes['rows'] = $this->struct['rows'];
43
44 }
45
46 /**
47 * Returns the main input field for rendering
48 *
49 * @since 1.0.0
50 * @see \uix\ui\uix
51 * @access public
52 * @return string
53 */
54 public function input(){
55
56 return '<' . esc_html( $this->type ) . ' ' . $this->build_attributes() . '>' . esc_textarea( $this->get_value() ) . '</' . esc_html( $this->type ) . '>';
57 }
58
59 }