public function save($menuID, $language, $title, $entryID, $data) { $menu = Menu::get($menuID); if ($menu == null) { $this->error(t('Menu not found')); $this->redirect('admin', 'menu', $language); return; } $entry = new MenuEntry; $entry->menuID = $menuID; $entry->title = $title; $entry->data = $data; $entry->entryID = $entryID; $entry->language = $language; try { $entry->save(); $this->notice(t('Menu entry added')); if ($language == I18n::getLanguage()) { $this->redirect('admin', 'menu', 'edit', $menuID); } else { $this->redirect('admin', 'menu', 'edit', $menuID, $language); } } catch (ValidationException $e) { $this->menu = $menu; $this->adminlanguage = $language; $this->providerActionCombos = Menu::providerActionCombos($language); $this->newEntry = $entry; $this->error(t('Entry was not saved')); $this->render('edit'); } }
public static function getLanguage() { $l = I18n::getLanguage(); return ($l == '' ? 'en' : $l); }