| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.0582 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 1 | public function renderFieldBlock(FieldInterface $field, DOMElement $fieldBlock, DOMElement $labelBlock, DOMElement $element, DOMElement $errorBlock = null) |
|
| 25 | { |
||
| 26 | 1 | if (!$field instanceof Select) { |
|
| 27 | throw new InvalidArgumentException('Must be a Del\Form\Field\Select'); |
||
| 28 | } |
||
| 29 | 1 | foreach ($field->getOptions() as $value => $label) { |
|
| 30 | 1 | $option = $this->dom->createElement('option'); |
|
| 31 | 1 | $option->setAttribute('value', $value); |
|
| 32 | 1 | $option->textContent = $label; |
|
| 33 | 1 | $element->appendChild($option); |
|
| 34 | } |
||
| 35 | 1 | $fieldBlock->appendChild($labelBlock); |
|
| 36 | 1 | $fieldBlock->appendChild($element); |
|
| 37 | 1 | if ($errorBlock) { |
|
| 38 | $fieldBlock->appendChild($errorBlock); |
||
| 39 | } |
||
| 40 | 1 | return $fieldBlock; |
|
| 41 | } |
||
| 42 | } |