public function add_content_section() { if (Loader::helper('validation/token')->validate('add_content_section')) { if (!Loader::helper('validation/numbers')->integer($this->post('pageID')) || $this->post('pageID') < 1) { $this->error->add(t('You must specify a page for this multilingual content section.')); } else { $pc = Page::getByID($this->post('pageID')); } if (!$this->error->has()) { $lc = MultilingualSection::getByID($this->post('pageID')); if (is_object($lc)) { $this->error->add(t('A language section page at this location already exists.')); } } if (!$this->error->has()) { if ($this->post('msIcon')) { $combination = $this->post('msLanguage') . '_' . $this->post('msIcon'); $locale = MultilingualSection::getByLocale($combination); if (is_object($locale)) { $this->error->add(t('This language/region combination already exists.')); } } } if (!$this->error->has()) { MultilingualSection::assign($pc, $this->post('msLanguage'), $this->post('msIcon')); $this->redirect('/dashboard/multilingual/setup', 'multilingual_content_updated'); } } else { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } $this->view(); }