| @@ 6-36 (lines=31) @@ | ||
| 3 | ||
| 4 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
|
| 5 | ||
| 6 | class FileField extends NativeGenerator implements iField |
|
| 7 | { |
|
| 8 | private $properties; |
|
| 9 | private $name; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * FileField constructor. Pass data inside the model. |
|
| 13 | * @param array $properties |
|
| 14 | * @param string $name |
|
| 15 | * @param string|null $value |
|
| 16 | */ |
|
| 17 | public function __construct($properties, $name, $value = null) |
|
| 18 | { |
|
| 19 | $this->properties = $properties; |
|
| 20 | $this->name = $name; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Build <input type="file" {$properties} /> response |
|
| 25 | * {@inheritDoc} |
|
| 26 | * @see \Ffcms\Core\Helper\HTML\Form\iField::make() |
|
| 27 | */ |
|
| 28 | public function make() |
|
| 29 | { |
|
| 30 | $this->properties['type'] = 'file'; |
|
| 31 | if (isset($this->properties['value'])) { |
|
| 32 | unset($this->properties['value']); |
|
| 33 | } |
|
| 34 | return self::buildSingleTag('input', $this->properties); |
|
| 35 | } |
|
| 36 | } |
|
| @@ 6-40 (lines=35) @@ | ||
| 3 | ||
| 4 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
|
| 5 | ||
| 6 | class PasswordField extends NativeGenerator implements iField |
|
| 7 | { |
|
| 8 | private $properties; |
|
| 9 | private $name; |
|
| 10 | private $value; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * PasswordField 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="password" {$properties} /> response |
|
| 28 | * {@inheritDoc} |
|
| 29 | * @see \Ffcms\Core\Helper\HTML\Form\iField::make() |
|
| 30 | */ |
|
| 31 | public function make() |
|
| 32 | { |
|
| 33 | if (isset($this->properties['value'])) { |
|
| 34 | unset($this->properties['value']); |
|
| 35 | } |
|
| 36 | $this->properties['type'] = 'password'; |
|
| 37 | ||
| 38 | return self::buildSingleTag('input', $this->properties); |
|
| 39 | } |
|
| 40 | } |
|