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