Created
September 11, 2018 13:31
-
-
Save shaneonabike/27236c923a1ae88875c3f513ea20ddb6 to your computer and use it in GitHub Desktop.
Drupal Timefield exposed filter integration (template.php)
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
/** | |
* Preprocess output of form element | |
* | |
*/ | |
function yourtheme_preprocess_form_element(&$vars) { | |
if (!empty($vars['element']['#id']) && ($vars['element']['#id'] == 'edit-hour')) { | |
// Add special class for JS to work properly but we need to edit the #children value :/ | |
$children = $vars['element']['#children']; | |
if (!empty($children)) { | |
$vars['element']['#children'] = str_replace('form-text', 'form-text edit-timefield-timepicker filter-project-event-time', $children); | |
} else $vars['#attributes']['class'][] = 'edit-timefield-timepicker'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment