| @@ 13-61 (lines=49) @@ | ||
| 10 | * @package Faulancer\Form\Type\Base |
|
| 11 | * @author Florian Knapp <[email protected]> |
|
| 12 | */ |
|
| 13 | class Email extends AbstractType |
|
| 14 | { |
|
| 15 | ||
| 16 | /** @var string */ |
|
| 17 | protected $inputType = 'input'; |
|
| 18 | ||
| 19 | /** @var string */ |
|
| 20 | protected $element = ''; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @return self |
|
| 24 | */ |
|
| 25 | public function create() |
|
| 26 | { |
|
| 27 | parent::create(); |
|
| 28 | ||
| 29 | $output = '<' . $this->inputType; |
|
| 30 | ||
| 31 | foreach ($this->definition['attributes'] as $attr => $value) { |
|
| 32 | ||
| 33 | if (!empty($this->getValue()) && $attr === 'value') { |
|
| 34 | continue; |
|
| 35 | } |
|
| 36 | ||
| 37 | if ($attr === 'type' && !empty($this->getType())) { |
|
| 38 | continue; |
|
| 39 | } |
|
| 40 | ||
| 41 | $output .= ' ' . $attr . '="' . $value . '" '; |
|
| 42 | ||
| 43 | } |
|
| 44 | ||
| 45 | if (!empty($this->getValue())) { |
|
| 46 | $output .= ' value="' . $this->getValue() . '"'; |
|
| 47 | } |
|
| 48 | ||
| 49 | if (!empty($this->getType())) { |
|
| 50 | $output .= ' type="' . $this->getType() . '"'; |
|
| 51 | } |
|
| 52 | ||
| 53 | $output .= ' />'; |
|
| 54 | ||
| 55 | $this->element = $output; |
|
| 56 | ||
| 57 | return $this; |
|
| 58 | } |
|
| 59 | ||
| 60 | } |
|
| @@ 13-61 (lines=49) @@ | ||
| 10 | * @package Faulancer\Form\Type\Base |
|
| 11 | * @author Florian Knapp <[email protected]> |
|
| 12 | */ |
|
| 13 | class Text extends AbstractType |
|
| 14 | { |
|
| 15 | ||
| 16 | /** @var string */ |
|
| 17 | protected $inputType = 'input'; |
|
| 18 | ||
| 19 | /** @var string */ |
|
| 20 | protected $element = ''; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * @return self |
|
| 24 | */ |
|
| 25 | public function create() |
|
| 26 | { |
|
| 27 | parent::create(); |
|
| 28 | ||
| 29 | $output = '<' . $this->inputType . ' '; |
|
| 30 | ||
| 31 | foreach ($this->definition['attributes'] as $attr => $value) { |
|
| 32 | ||
| 33 | if (!empty($this->getValue()) && $attr === 'value') { |
|
| 34 | continue; |
|
| 35 | } |
|
| 36 | ||
| 37 | if ($attr === 'type' && !empty($this->getType())) { |
|
| 38 | continue; |
|
| 39 | } |
|
| 40 | ||
| 41 | $output .= $attr . '="' . $value . '" '; |
|
| 42 | ||
| 43 | } |
|
| 44 | ||
| 45 | if (!empty($this->getValue())) { |
|
| 46 | $output .= ' value="' . $this->getValue() . '"'; |
|
| 47 | } |
|
| 48 | ||
| 49 | if (!empty($this->getType())) { |
|
| 50 | $output .= ' type="' . $this->getType() . '"'; |
|
| 51 | } |
|
| 52 | ||
| 53 | $output .= ' />'; |
|
| 54 | ||
| 55 | $this->element = $output; |
|
| 56 | ||
| 57 | return $this; |
|
| 58 | } |
|
| 59 | ||
| 60 | } |
|