public function DeleteUpdateForm::submitForm in Scheduled Publish 8.3
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ DeleteUpdateForm.php, line 205 - Contains \Drupal\scheduled_publish\Form\DeleteUpdateForm.
Class
Namespace
Drupal\scheduled_publish\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $form_state
->get([
'scheduled_publish',
'entity',
]);
$field = $form_state
->get([
'scheduled_publish',
'field',
]);
$delta = $form_state
->get([
'scheduled_publish',
'field_delta',
]);
$states = $entity
->get($field)
->getValue();
unset($states[$delta]);
$this
->handleStates($form_state, $states);
// Reload entity to be sure it's not old.
$entity = \Drupal::entityTypeManager()
->getStorage($entity
->getEntityTypeId())
->load($entity
->id());
$entity
->set($field, $states);
$entity
->save();
$this
->messenger()
->addStatus($this
->t('Status update deleted.'));
}