Created
February 10, 2017 11:30
-
-
Save victor-shelepen/786746874572bc80e650645e86a6ba32 to your computer and use it in GitHub Desktop.
Implements the filter form that redirects to the page with parametes. Empty parameters are emmited.
This file contains 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
/** | |
* Implements FORM_ID_submit. | |
*/ | |
function custom_user_auto_ecole_mes_examens_form_submit($form, &$form_state) { | |
if ($form_state['values']['op'] == t('Search')) { | |
$query = array_intersect_key( | |
$form_state['values']['filters'], | |
array_flip( | |
array_filter( | |
array_keys($form_state['values']['filters']), | |
function ($var) use ($form_state) { | |
return !empty($form_state['values']['filters'][$var]); | |
} | |
) | |
) | |
); | |
$form_state['redirect'] = array( | |
current_path(), | |
array('query' => array('filters' => $query)) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment