Ejemplo n.º 1
0
 /**
  * Saves an element instance to a parent
  *
  */
 function save()
 {
     $id_element = $this->input->post('id_element');
     $parent = $this->input->post('parent');
     $id_parent = $this->input->post('id_parent');
     if (!empty($parent) && !empty($id_parent)) {
         // Clear the cache
         Cache()->clear_cache();
         $id_element_definition = $this->input->post('id_element_definition');
         // Save Element and extend fields
         $id_element = $this->element_model->save($parent, $id_parent, $id_element, $id_element_definition, $_POST);
         // Get Elements
         $this->callback = array(array('fn' => 'ION.updateContentTabs', 'args' => array($parent, $id_parent)));
         // Answer
         $this->success(lang('ionize_message_content_element_saved'), array('id_element' => $id_element));
     } else {
         $this->callback = array(array('fn' => 'ION.notification', 'args' => array('error', lang('ionize_message_element_cannot_be_added_to_parent'))));
     }
     $this->response();
 }