| @@ 100-112 (lines=13) @@ | ||
| 97 | * |
|
| 98 | * @return string |
|
| 99 | */ |
|
| 100 | public function getAttributes() |
|
| 101 | { |
|
| 102 | $result = []; |
|
| 103 | foreach ($this->element->getAttributes() as $attribute => $value) { |
|
| 104 | if (null === $value) { |
|
| 105 | $result[] = $attribute; |
|
| 106 | continue; |
|
| 107 | } |
|
| 108 | ||
| 109 | $result[] = "{$attribute}=\"{$value}\""; |
|
| 110 | } |
|
| 111 | return implode(' ', $result); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Render the HTML element in the provided context |
|
| @@ 37-50 (lines=14) @@ | ||
| 34 | * |
|
| 35 | * @return string |
|
| 36 | */ |
|
| 37 | public function getLabelAttributes() |
|
| 38 | { |
|
| 39 | $result = []; |
|
| 40 | $label = $this->element->getLabel(); |
|
| 41 | foreach ($label->getAttributes() as $attribute => $value) { |
|
| 42 | if (null === $value) { |
|
| 43 | $result[] = $attribute; |
|
| 44 | continue; |
|
| 45 | } |
|
| 46 | ||
| 47 | $result[] = "{$attribute}=\"{$value}\""; |
|
| 48 | } |
|
| 49 | return implode(' ', $result); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Returns the elements's attributes as a string |
|