Guest User

Untitled

a guest
May 16th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. $form['actions']['submit']['#submit'][] = 'mymodule_upload_enabled_types_submit';
  2.  
  3. $form['actions']['submit']['#submit'][] = 'mymodule_what_ever_function';
  4.  
  5. $form['#submit'][1] = test_function;
  6.  
  7. unset($form["actions"]['submit']);
  8.  
  9. $form['actions']['submit']['#submit'][] = 'mymodule_upload_enabled_types_submit';
  10.  
  11. $form['#submit'][] = 'mymodule_upload_enabled_types_submit';
  12.  
  13. <?php
  14.  
  15. use DrupalCoreFormFormStateInterface;
  16.  
  17. /**
  18. * Implements hook_form_alter().
  19. */
  20. function my_module_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  21.  
  22. // Use this to reveal the form id.
  23. //drupal_set_message($form_id);
  24.  
  25. // Use this with the devel module to inspect the button action(s).
  26. //kint($form['actions']);
  27.  
  28. switch ($form_id) {
  29.  
  30. case 'node_article_form': // New article nodes.
  31. case 'node_article_edit_form': // Existing article nodes.
  32.  
  33. // Attach our custom submit handler.
  34. $form['actions']['publish']['#submit'][] = 'my_module_node_article_form_submit';
  35. break;
  36.  
  37. }
  38.  
  39. }
  40.  
  41. function my_module_node_article_form_submit($form, FormStateInterface $form_state) {
  42. drupal_set_message('Running custom submit handler...');
  43. }
  44.  
  45. unpublish
  46. preview
  47. delete
Add Comment
Please, Sign In to add comment