| @@ 357-382 (lines=26) @@ | ||
| 354 | * @param type $tabName the name of the tab to be renamed |
|
| 355 | * @param type $newTabName the new name for the tab |
|
| 356 | */ |
|
| 357 | public function renameFormTab($tabName, $newTabName, $keepOrder = true) |
|
| 358 | { |
|
| 359 | $tabs = $this->getFormTabs(); |
|
| 360 | ||
| 361 | if (!$tabs) { |
|
| 362 | return; |
|
| 363 | } |
|
| 364 | ||
| 365 | if (!isset($tabs[$tabName])) { |
|
| 366 | throw new \Exception(sprintf('Tab %s does not exist.', $tabName)); |
|
| 367 | } |
|
| 368 | if (isset($tabs[$newTabName])) { |
|
| 369 | return; |
|
| 370 | } |
|
| 371 | ||
| 372 | if ($keepOrder) { |
|
| 373 | $keys = array_keys($tabs); |
|
| 374 | $keys[array_search($tabName, $keys)] = $newTabName; |
|
| 375 | $tabs = array_combine($keys, $tabs); |
|
| 376 | } else { |
|
| 377 | $tabs[$newTabName] = $tabs[$tabName]; |
|
| 378 | unset($tabs[$tabName]); |
|
| 379 | } |
|
| 380 | ||
| 381 | $this->setFormTabs($tabs); |
|
| 382 | } |
|
| 383 | ||
| 384 | /** |
|
| 385 | * Rename a show tab after show fields have been configured. |
|
| @@ 392-417 (lines=26) @@ | ||
| 389 | * @param type $tabName the name of the tab to be renamed |
|
| 390 | * @param type $newTabName the new name for the tab |
|
| 391 | */ |
|
| 392 | public function renameShowTab($tabName, $newTabName, $keepOrder = true) |
|
| 393 | { |
|
| 394 | $tabs = $this->getShowTabs(); |
|
| 395 | ||
| 396 | if (!$tabs) { |
|
| 397 | return; |
|
| 398 | } |
|
| 399 | ||
| 400 | if (!isset($tabs[$tabName])) { |
|
| 401 | throw new \Exception(sprintf('Tab %s does not exist.', $tabName)); |
|
| 402 | } |
|
| 403 | if (isset($tabs[$newTabName])) { |
|
| 404 | return; |
|
| 405 | } |
|
| 406 | ||
| 407 | if ($keepOrder) { |
|
| 408 | $keys = array_keys($tabs); |
|
| 409 | $keys[array_search($tabName, $keys)] = $newTabName; |
|
| 410 | $tabs = array_combine($keys, $tabs); |
|
| 411 | } else { |
|
| 412 | $tabs[$newTabName] = $tabs[$tabName]; |
|
| 413 | unset($tabs[$tabName]); |
|
| 414 | } |
|
| 415 | ||
| 416 | $this->setShowTabs($tabs); |
|
| 417 | } |
|
| 418 | ||
| 419 | /** |
|
| 420 | * Rename a form group. |
|