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