getTabGroups(); $keys = array_keys($groups); $default = (string) reset($keys); $group = (string) $this->getRequestParameter('tab_group', $default); return isset($groups[$group]) === true ? $group : $default; } public function getSections(): array { $groups = $this->getTabGroups(); return $groups[$this->getCurrentTabGroup()] ?? []; } public function getCurrentTabGroupSection(): string { $groups = $this->getTabGroups(); $sections = (array) ($groups[$this->getCurrentTabGroup()] ?? reset($groups)); $default = (string) reset($sections); $section = (string) $this->getRequestParameter('tab_group_section', $default); return in_array($section, $sections, true) === true ? $section : $default; } public function getTabGroupLink(string $groupKey): string { $rawUrl = $this->getRequestUrl(); $url = preg_replace('/&tab_group[^&]*/i', '', $rawUrl); return $url . '&tab_group=' . $groupKey; } public function getTabGroupSectionLink(string $groupKey, string $sectionKey): string { $rawUrl = $this->getTabGroupLink($groupKey); $url = preg_replace('/&tab_group_section[^&]*/i', '', $rawUrl); return $url . '&tab_group_section=' . $sectionKey; } }