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