Skip to content

Commit

Permalink
Added a getSaveData function in form controller to easily override da…
Browse files Browse the repository at this point in the history
…ta source
  • Loading branch information
julienV committed Apr 16, 2017
1 parent d14efeb commit 12a4023
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion libraries/legacy/controller/form.php
Expand Up @@ -624,7 +624,7 @@ public function save($key = null, $urlVar = null)
$app = JFactory::getApplication();
$model = $this->getModel();
$table = $model->getTable();
$data = $this->input->post->get('jform', array(), 'array');
$data = $this->getSaveData();
$checkin = property_exists($table, $table->getColumnAlias('checked_out'));
$context = "$this->option.edit.$this->context";
$task = $this->getTask();
Expand Down Expand Up @@ -838,4 +838,17 @@ public function save($key = null, $urlVar = null)

return true;
}

/**
* Get the data for form saving
* Allows for subclasses to get data from multiple sources (e.g. $this->input->files)
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
protected function getSaveData()
{
return $this->input->post->get('jform', array(), 'array');
}
}

0 comments on commit 12a4023

Please sign in to comment.