© 2026 Hedgehog Software, LLC
class PageController extends NestedModuleController { //... protected function form(?int $id, TwillModelContract $item = null): array { $item = $this->repository->getById($id, $this->formWith, $this->formWithCount); $this->permalinkBase = $item->ancestorsSlug; return parent::form($id, $item); } }
getLocalizedPermalinkBase()
class PageController extends NestedModuleController { //... /// we will store localized slugs here: protected array $localizedPermalinkBase = []; protected function form(?int $id, ?TwillModelContract $item = null): array { $item = $this->repository->getById($id, $this->formWith, $this->formWithCount); ///default locale ancestor slug $this->permalinkBase = $item->ancestorsSlug; ///multiple locale ancestor slugs $locales = config('translatable.locales'); $this->localizedPermalinkBase = []; foreach (config('translatable.locales') as $locale) { $this->localizedPermalinkBase[$locale] = $item->getAncestorsSlug($locale); } return parent::form($id, $item); } protected function getLocalizedPermalinkBase(): array { /// this function is called on parent::form so we should be safe return $this->localizedPermalinkBase; } }