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 = Section::getByID($this->post('pageID')); if (is_object($lc)) { $this->error->add(t('A multilingual section page at this location already exists.')); } } if (!$this->error->has()) { if ($this->post('msLanguage')) { $combination = $this->post('msLanguage') . '_' . $this->post('msCountry'); $locale = Section::getByLocale($combination); if (is_object($locale)) { $this->error->add(t('This language/region combination already exists.')); } } } if (!$this->error->has()) { Section::assign($pc, $this->post('msLanguage'), $this->post('msCountry')); $this->redirect('/dashboard/system/multilingual/setup', 'multilingual_content_updated'); } } else { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } $this->view(); }