0

I have written a module for Drupal 8 which creates a custom entity type. In this module, I have a link/route, that updates a field when the user goes to the custom update page and confirms the action, which acts very similar to the delete page (they both extend ContentEntityConfirmFormBase).

On the submitForm(array &$form, FormStateInterface $form_state) function, I have the following that gets run:

$entity = $this->getEntity();
$entity->setCancel(1);
$entity->save();
drupal_set_message(t('Process stopped'));

I would like to avoid needing to go the confirmation page, but I'm not sure what the class should extend from instead of ContentEntityConfirmFormBase.

And ideally, even turn it into an Ajax link/route which I can then use anywhere.

Any help is greatly appreciated

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.