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