/**
* Configures necessary components when CRUD is in the adding mode.
*
* @param array $fields List of fields for add form
*
* @return void|Model If model, then bail out, no greed needed
*/
protected function configureAdd($fields = null)
{
// We are actually in the frame!
if ($this->isEditing('add')) {
$this->model->unload();
$m = $this->form->setModel($this->model, $fields);
$this->form->addSubmit('Add');
$this->form->onSubmit(array($this, 'formSubmit'));
return $m;
} elseif ($this->isEditing()) {
return;
}
// Configure Add Button on Grid and JS
$this->add_button->js('click')->univ()->frameURL($this->app->_($this->entity_name === false ? 'New Record' : 'Adding new ' . $this->entity_name), $this->virtual_page->getURL('add'), $this->frame_options);
if ($this->entity_name !== false) {
$this->add_button->setHTML('<i class="icon-plus"></i> Add ' . htmlspecialchars($this->entity_name));
}
}