I have one form of exposed filters of view. I need to override few elements of that, like change options for select box dropdown and like that.
For that I have created view, and used hook_form_alter
, but the changes are not reflecting.
My work:
function custom_module_form_alter($form, &$form_state, $form_id) {
if ($form_id == 'views_exposed_form' && $form['#id'] ==
'views-exposed-form-advanced-search-page') {
print_r($form['submit']); //debug
$form['submit']['#value'] = t('Search');
print_r($form['submit']); //debug
}
}
As shown above, to test, I am just trying to alter the label of submit button, and for debugging, I have added two print_f
, statement, output of which are as follows:
First print_f():
Array ( [#name] =>
[#type] => submit
[#value] => Apply
[#id] => edit-submit-advanced-search
)
Second print_f():
Array ( [#name] =>
[#type] => submit
[#value] => Search
[#id] => edit-submit-advanced-search
)
As shown, the label is changing, but it is not reflecting to the form.
Considering module weight, I have also tried giving more weight to my module tham views weight. But nothing changed.
Please suggest, if I am missing something.
-- Thanks for your time.