public function RestExampleClientDelete::submitForm in Examples for Developers 3.x
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');
}