function RestExampleClientDelete::submitForm
Same name in other branches
- 4.0.x modules/rest_example/src/Form/RestExampleClientDelete.php \Drupal\rest_example\Form\RestExampleClientDelete::submitForm()
Throws
\GuzzleHttp\Exception\GuzzleException
Overrides FormInterface::submitForm
File
-
modules/
rest_example/ src/ Form/ RestExampleClientDelete.php, line 96
Class
- RestExampleClientDelete
- Delete a new node on a remote Drupal site.
Namespace
Drupal\rest_example\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$node_id = $form_state->get('node_id');
$node = [
'nid' => $node_id,
];
$this->restExampleClientCalls
->delete($node);
$this->messenger()
->addStatus($this->t('Node was successfully deleted'));
$form_state->setRedirect('rest_example.client_actions_index');
}