| @@ 140-150 (lines=11) @@ | ||
| 137 | $mapper->remove($key); |
|
| 138 | ||
| 139 | // compensating the partial removal in Sonata Admin, that does not touch the groups when removing a field |
|
| 140 | if ($mapper instanceof BaseGroupedMapper) { |
|
| 141 | foreach ($groups = $this->{$fcts['groups']['getter']}() as $groupkey => $group) { |
|
| 142 | if (isset($group['fields'][$key])) { |
|
| 143 | unset($groups[$groupkey]['fields'][$key]); |
|
| 144 | if (!$groups[$groupkey]['fields']) { |
|
| 145 | unset($groups[$groupkey]); |
|
| 146 | } |
|
| 147 | $this->{$fcts['groups']['setter']}($groups); |
|
| 148 | } |
|
| 149 | } |
|
| 150 | } |
|
| 151 | } |
|
| 152 | } |
|
| 153 | } |
|
| @@ 195-208 (lines=14) @@ | ||
| 192 | ||
| 193 | // removing empty tabs |
|
| 194 | $tabs = $this->{$fcts['tabs']['getter']}(); |
|
| 195 | if (is_array($tabs)) { |
|
| 196 | foreach ($tabs as $tabkey => $tab) { |
|
| 197 | foreach ($tab['groups'] as $groupkey => $group) { |
|
| 198 | if (!isset($this->{$fcts['groups']['getter']}()[$group])) { |
|
| 199 | unset($tabs[$tabkey]['groups'][$groupkey]); |
|
| 200 | } |
|
| 201 | } |
|
| 202 | ||
| 203 | if (!$tabs[$tabkey]['groups']) { |
|
| 204 | unset($tabs[$tabkey]); |
|
| 205 | } |
|
| 206 | } |
|
| 207 | $this->{$fcts['tabs']['setter']}($tabs); |
|
| 208 | } |
|
| 209 | } |
|
| 210 | ||
| 211 | $this->fixTemplates($mapper); |
|