- Status changed to Closed: works as designed
about 1 year ago 4:21pm 31 October 2023 - 🇳🇴Norway farald
You can also use a static method inside the same plugin class:
$form['delete_queue'] = [ '#type' => 'submit', '#value' => $this->t('Delete queue'), '#submit' => ['\Drupal\mymodule\Plugin\Formalter\UserFormAlter::deleteQueue'], '#button_type' => 'primary', ];
And then add a static:
public static function deleteQueue(array &$form, FormStateInterface $form_state) { \Drupal::messenger()->addMessage(t("Deleted @queue successfully.")); }