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