Created
October 4, 2012 17:39
-
-
Save soulston/3835190 to your computer and use it in GitHub Desktop.
Views exposed filter labels
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 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