| Conditions | 8 |
| Paths | 12 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function create() |
||
| 26 | { |
||
| 27 | parent::create(); |
||
| 28 | |||
| 29 | $output = ''; |
||
| 30 | |||
| 31 | if (!empty($this->definition['default'])) { |
||
| 32 | |||
| 33 | $output .= '<' . $this->inputType; |
||
| 34 | $output .= ' type="hidden"'; |
||
| 35 | $output .= ' name="' . $this->definition['attributes']['name'] . '"'; |
||
| 36 | $output .= ' ' . 'value="' . $this->definition['default'] . '"'; |
||
| 37 | $output .= '/>'; |
||
| 38 | |||
| 39 | } |
||
| 40 | |||
| 41 | $output .= '<' . $this->inputType; |
||
| 42 | |||
| 43 | foreach ($this->definition['attributes'] as $attr => $value) { |
||
| 44 | $output .= ' ' . $attr . '="' . $value . '" '; |
||
| 45 | } |
||
| 46 | |||
| 47 | if (!empty($this->getValue()) && $this->definition['attributes']['value'] === $this->getValue()) { |
||
| 48 | $output .= ' checked="checked"'; |
||
| 49 | } elseif (empty($this->getValue()) && isset($this->definition['checked']) && $this->definition['checked'] === true) { |
||
| 50 | $output .= ' checked="checked"'; |
||
| 51 | } |
||
| 52 | |||
| 53 | $output .= '/>'; |
||
| 54 | |||
| 55 | $this->element = $output; |
||
| 56 | |||
| 57 | return $this; |
||
| 58 | } |
||
| 59 | |||
| 60 | } |