/** * Gets the submitted locale. if the provided locale is not null, this will be used, else the * LocalizePanelForm will be checked. * @param string $locale * @return string Code of the submitted locale * @throws zibo\ZiboException when no locale is provided through an argument or the LocalizePanelForm */ private function getSubmittedLocale($locale) { if ($locale !== null) { return $locale; } $form = new LocalizePanelForm(); if ($form->isSubmitted()) { return $form->getLocaleCode(); } throw new ZiboException('No locale provided and the LocalizePanelForm is not submitted'); }