public function __actionEdit() { $fields = $_POST['fields']; $is_new = !isset($this->_indexes[$this->_section->get('id')]); $this->_indexes[$this->_section->get('id')]['fields'] = $fields['included_elements']; $this->_indexes[$this->_section->get('id')]['weighting'] = $fields['weighting']; if (!is_array($fields['filter'])) { $fields['filter'] = array($fields['filter']); } $filters = array(); foreach ($fields['filter'] as $filter) { if (is_null($filter)) { continue; } $filters[key($filter)] = $filter[key($filter)]; } $this->_indexes[$this->_section->get('id')]['filters'] = $filters; SearchIndex::saveIndexes($this->_indexes); redirect("{$this->_uri}/indexes/"); }