Example #1
0
 /**
  * [Node] Format form values from add/edit form for save
  *
  * @param	array	$values	Values from the form
  * @return	array
  */
 public function processForm($values)
 {
     if (!$this->id) {
         $this->save();
         \IPS\File::claimAttachments('custom-markers-new', $this->id);
     }
     if (isset($values['marker_parent_id']) and (!empty($values['marker_parent_id']) or $values['marker_parent_id'] === 0)) {
         $this->parent_id = $values['marker_parent_id']->id;
     }
     foreach (array('marker_description', 'marker_name', 'marker_location', 'marker_lat', 'marker_lon') as $val) {
         if (isset($values[$val])) {
             $key = str_replace('marker_', '', $val);
             $this->{$key} = $values[$val];
         }
     }
     parent::processForm($values);
 }