🇳🇴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."));
}
🇳🇴Norway farald