@@ 6-42 (lines=37) @@ | ||
3 | ||
4 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
|
5 | ||
6 | class DivFakeField extends NativeGenerator implements iField |
|
7 | { |
|
8 | private $properties; |
|
9 | private $name; |
|
10 | private $value; |
|
11 | ||
12 | /** |
|
13 | * DivFakeField constructor. Pass attributes inside model. |
|
14 | * @param array $properties |
|
15 | * @param string $name |
|
16 | * @param string|null $value |
|
17 | */ |
|
18 | public function __construct($properties, $name, $value = null) |
|
19 | { |
|
20 | $this->properties = $properties; |
|
21 | $this->name = $name; |
|
22 | $this->value = $value; |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * Build <div $properties>$value</div> response |
|
27 | * {@inheritDoc} |
|
28 | * @see \Ffcms\Core\Helper\HTML\Form\iField::make() |
|
29 | */ |
|
30 | public function make() |
|
31 | { |
|
32 | // value is not required in properties now |
|
33 | unset($this->properties['value']); |
|
34 | $html = false; |
|
35 | if (isset($this->properties['html']) && $this->properties['html'] === true) { |
|
36 | $html = true; |
|
37 | unset($this->properties['html']); |
|
38 | } |
|
39 | ||
40 | return self::buildContainerTag('div', $this->properties, $this->value, $html); |
|
41 | } |
|
42 | } |
@@ 6-46 (lines=41) @@ | ||
3 | ||
4 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
|
5 | ||
6 | class TextareaField extends NativeGenerator implements iField |
|
7 | { |
|
8 | private $properties; |
|
9 | private $name; |
|
10 | private $value; |
|
11 | ||
12 | /** |
|
13 | * TextField constructor. Pass attributes inside model. |
|
14 | * @param array $properties |
|
15 | * @param string $name |
|
16 | * @param string|null $value |
|
17 | */ |
|
18 | public function __construct($properties, $name, $value = null) |
|
19 | { |
|
20 | $this->properties = $properties; |
|
21 | $this->name = $name; |
|
22 | $this->value = $value; |
|
23 | } |
|
24 | ||
25 | ||
26 | /** |
|
27 | * Build <input type="text" value="$value" {$properties} /> response |
|
28 | * {@inheritDoc} |
|
29 | * @see \Ffcms\Core\Helper\HTML\Form\iField::make() |
|
30 | */ |
|
31 | public function make() |
|
32 | { |
|
33 | // check is html enabled there |
|
34 | $html = false; |
|
35 | if (isset($this->properties['html']) && $this->properties['html'] === true) { |
|
36 | $html = true; |
|
37 | unset($this->properties['html']); |
|
38 | } |
|
39 | // unset value |
|
40 | if (isset($this->properties['value'])) { |
|
41 | unset($this->properties['value']); |
|
42 | } |
|
43 | // return compiled DOM html |
|
44 | return self::buildContainerTag('textarea', $this->properties, $this->value, $html); |
|
45 | } |
|
46 | } |