|
@@ 462-474 (lines=13) @@
|
| 459 |
|
* @param string|array $tabNames name or array of names of tabs to be removed |
| 460 |
|
* @param FormMapper $mapper Sonata Admin form mapper |
| 461 |
|
*/ |
| 462 |
|
public function removeTab($tabNames, $mapper) |
| 463 |
|
{ |
| 464 |
|
$currentTabs = $this->getFormTabs(); |
| 465 |
|
foreach ($currentTabs as $k => $item) { |
| 466 |
|
if (is_array($tabNames) && in_array($item['name'], $tabNames) || !is_array($tabNames) && $item['name'] === $tabNames) { |
| 467 |
|
foreach ($item['groups'] as $groupName) { |
| 468 |
|
$this->removeAllFieldsFromFormGroup($groupName, $mapper); |
| 469 |
|
} |
| 470 |
|
unset($currentTabs[$k]); |
| 471 |
|
} |
| 472 |
|
} |
| 473 |
|
$this->setFormTabs($currentTabs); |
| 474 |
|
} |
| 475 |
|
|
| 476 |
|
/** |
| 477 |
|
* Removes tab in current show Mapper. |
|
@@ 482-494 (lines=13) @@
|
| 479 |
|
* @param string|array $tabNames name or array of names of tabs to be removed |
| 480 |
|
* @param ShowMapper $mapper Sonata Admin form mapper |
| 481 |
|
*/ |
| 482 |
|
public function removeShowTab($tabNames, $mapper) |
| 483 |
|
{ |
| 484 |
|
$currentTabs = $this->getShowTabs(); |
| 485 |
|
foreach ($currentTabs as $k => $item) { |
| 486 |
|
if (is_array($tabNames) && in_array($item['name'], $tabNames) || !is_array($tabNames) && $item['name'] === $tabNames) { |
| 487 |
|
foreach ($item['groups'] as $groupName) { |
| 488 |
|
$this->removeAllFieldsFromShowGroup($groupName, $mapper); |
| 489 |
|
} |
| 490 |
|
unset($currentTabs[$k]); |
| 491 |
|
} |
| 492 |
|
} |
| 493 |
|
$this->setShowTabs($currentTabs); |
| 494 |
|
} |
| 495 |
|
|
| 496 |
|
/** |
| 497 |
|
* Removes all fields from form groups and remove them from mapper. |