Textarea::renderInner()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
ccs 0
cts 7
cp 0
crap 2
rs 9.9666
c 0
b 0
f 0
1
<?php
2
namespace Rocket\UI\Forms\Fields;
3
4
/**
5
 * Manage textarea
6
 */
7
8
/**
9
 * Creates a Textarea with Form_element
10
 *
11
 * @author Stéphane Goetz
12
 */
13
class Textarea extends Field
14
{
15
    /**
16
     * Change the textarea attributes to be compatible
17
     */
18
    protected function inputAttributes()
19
    {
20
        $this->input_attributes['id'] = $this->id;
21
        $this->input_attributes['name'] = $this->name;
22
        $this->input_attributes['cols'] = 90;
23
        $this->input_attributes['rows'] = $this->params['height'];
24
    }
25
26
    /**
27
     * Render the file as a textarea and not input
28
     */
29
    protected function renderInner()
30
    {
31
        $val = $this->input_attributes['value'];
32
        unset($this->input_attributes['value']);
33
34
        $attributes = $this->renderAttributes($this->input_attributes);
35
36
        $this->result .= "<textarea $attributes>" . htmlentities($val, ENT_QUOTES, 'UTF-8', false) . '</textarea>';
37
    }
38
}
39