Created
March 16, 2015 12:45
-
-
Save mkorostoff/b59fd31c9cd245b70df6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
my_module_FORM_ID_alter(&$form) { | |
//Add a custom button | |
$form['my_button'] = array( | |
'#type' => 'button', | |
'#value' => t('My Buttom'), | |
'#executes_submit_callback' => TRUE, | |
); | |
//Add a custom submit handler | |
$form['#submit'][] = 'my_module_custom_submit_handler'; | |
} | |
function my_module_custom_submit_handler($form, &$form_state) { | |
//Add a special redirect for users who clicked 'my_button' | |
if ($form_state['clicked_button']['#value'] === 'my_button') { | |
$form_state['redirect'] = 'path/to/my/special/redirect'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment