Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Drupal Timefield exposed filter integration (template.php)
* 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
You can’t perform that action at this time.