public BlockContentTypeForm::save(array $form, FormStateInterface $form_state)
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
- core/modules/block_content/src/BlockContentTypeForm.php, line 94
Class
- BlockContentTypeForm
- Base form for category edit forms.
Namespace
Drupal\block_content
Code
public function save(array $form, FormStateInterface $form_state) { $block_type = $this->entity; $status = $block_type->save(); $edit_link = $this->entity->link($this->t('Edit')); $logger = $this->logger('block_content'); if ($status == SAVED_UPDATED) { drupal_set_message(t('Custom block type %label has been updated.', array('%label' => $block_type->label()))); $logger->notice('Custom block type %label has been updated.', array('%label' => $block_type->label(), 'link' => $edit_link)); } else { block_content_add_body_field($block_type->id()); drupal_set_message(t('Custom block type %label has been added.', array('%label' => $block_type->label()))); $logger->notice('Custom block type %label has been added.', array('%label' => $block_type->label(), 'link' => $edit_link)); } $form_state->setRedirectUrl($this->entity->urlInfo('collection')); }
Please login to continue.