Skip to content

Instantly share code, notes, and snippets.

@soulston
Created October 4, 2012 17:39
Show Gist options
  • Save soulston/3835190 to your computer and use it in GitHub Desktop.
Save soulston/3835190 to your computer and use it in GitHub Desktop.
Views exposed filter labels
/**
* Implements hook_form_alter().
To Replace the -Any- value in filters by it's label text
*/
function theme_form_alter(&$form, &$form_state, $form_id) {
kpr($form);
if ($form['#id'] == 'views-exposed-form-admin-people-block-1') {
// $my_label = 'label name';
foreach($form['#info'] as $key => $filter) {
if (stripos($key, 'filter-field') !== 0) {
$my_label = $form['#info'][$key]['label'];
$value = $form['#info'][$key]['value'];
if (isset($form[$value]['All'])) {
$form[$value]['All'] = $my_label;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment