public function EntityformTypeForm::save in Entityform 8.3
Form submission handler for the 'save' action.
Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
Overrides EntityForm::save
File
- src/
EntityformTypeForm.php, line 199 - Contains \Drupal\entityform\EntityformTypeFormController.
Class
- EntityformTypeForm
- Form controller for entityform type forms.
Namespace
Drupal\entityformCode
public function save(array $form, FormStateInterface $form_state) {
$type = $this->entity;
$type->type = trim($type
->id());
$type->name = trim($type->name);
$status = $type
->save();
$context = array(
'%name' => $type
->label(),
);
if ($status == SAVED_UPDATED) {
drupal_set_message(t('The Entityform type %name has been updated.', $context));
}
elseif ($status == SAVED_NEW) {
drupal_set_message(t('The Entityform type %name has been added.', $context));
$this
->logger('entityform')
->notice('Added Entityform type %name.', $context);
}
//$form_state['redirect'] = 'entityform.overview_types';
$form_state
->setRedirectUrl($type
->urlInfo('collection'));
}