| 1 | <?php |
||
| 21 | class GroupField extends Field |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * A list of class properties to be added to attributes. |
||
| 25 | * |
||
| 26 | * @var array |
||
| 27 | */ |
||
| 28 | protected $injectedProperties = []; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The field's default element. |
||
| 32 | * |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $element = 'div'; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * List of managed fields. |
||
| 39 | * |
||
| 40 | * @var array |
||
| 41 | */ |
||
| 42 | protected $fields = []; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Set managed fields. |
||
| 46 | * |
||
| 47 | * @param array $fields |
||
| 48 | * |
||
| 49 | * @return $this |
||
| 50 | */ |
||
| 51 | 8 | public function fields(array $fields) |
|
| 61 | |||
| 62 | /** |
||
| 63 | * Render the field. |
||
| 64 | * |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | 8 | public function render() |
|
| 75 | |||
| 76 | /** |
||
| 77 | * Render the field content. Rendering the managed fields. |
||
| 78 | * |
||
| 79 | * @return string |
||
| 80 | */ |
||
| 81 | 8 | public function getContent() |
|
| 82 | { |
||
| 83 | 8 | $currentLabelWidths = \Former::getOption('TwitterBootstrap3.labelWidths'); |
|
| 84 | 8 | \Former::setOption('TwitterBootstrap3.labelWidths', [ |
|
| 85 | 8 | 'large' => 0, |
|
| 86 | 8 | ]); |
|
| 87 | |||
| 88 | 8 | $output = ''; |
|
| 89 | 8 | foreach ($this->fields as $field) { |
|
| 90 | 8 | $output .= $field->__toString(); |
|
| 91 | 8 | } |
|
| 92 | |||
| 93 | 8 | \Former::setOption('TwitterBootstrap3.labelWidths', $currentLabelWidths); |
|
| 94 | |||
| 95 | 8 | return $output; |
|
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * Returns values stored in managed fields. |
||
| 100 | * |
||
| 101 | * @return array |
||
| 102 | */ |
||
| 103 | public function getValue() |
||
| 104 | { |
||
| 105 | if (!is_array($this->fields)) { |
||
| 106 | return []; |
||
|
1 ignored issue
–
show
|
|||
| 107 | } |
||
| 108 | |||
| 109 | return array_map(function (Field $field) { |
||
|
1 ignored issue
–
show
|
|||
| 110 | return $field->getValue(); |
||
| 111 | }, $this->fields); |
||
| 112 | } |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Set the matching ID on a field if possible |
||
| 116 | * Override to prefix the id with group-. |
||
| 117 | * |
||
| 118 | * @param string $name |
||
| 119 | * |
||
| 120 | * @return string |
||
| 121 | */ |
||
| 122 | 8 | protected function getUniqueId($name) |
|
| 126 | } |
||
| 127 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.