public function JsonapiResourceConfigForm::save in JSON:API Extras 8
Same name and namespace in other branches
- 8.3 src/Form/JsonapiResourceConfigForm.php \Drupal\jsonapi_extras\Form\JsonapiResourceConfigForm::save()
- 8.2 src/Form/JsonapiResourceConfigForm.php \Drupal\jsonapi_extras\Form\JsonapiResourceConfigForm::save()
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/
Form/ JsonapiResourceConfigForm.php, line 195
Class
- JsonapiResourceConfigForm
- Base form for jsonapi_resource_config.
Namespace
Drupal\jsonapi_extras\FormCode
public function save(array $form, FormStateInterface $form_state) {
$resource_config = $this->entity;
$status = $resource_config
->save();
switch ($status) {
case SAVED_NEW:
drupal_set_message($this
->t('Created the %label JSON API Resource overwrites.', [
'%label' => $resource_config
->label(),
]));
break;
default:
drupal_set_message($this
->t('Saved the %label JSON API Resource overwrites.', [
'%label' => $resource_config
->label(),
]));
}
$form_state
->setRedirectUrl($resource_config
->urlInfo('collection'));
}