Views one of the great module available in Drupal. Views can be used to show various types of dynamic data and can also be used to allow users to filter results based on his criteria. To allow users to filter results based on his criteria we normally use views "exposed filter" option in every filter we add in view (screenshot 1.0).
screenshot 1.0
The default submit button added by view for exposed filter form has "Apply" as text. Now we will be looking at how to change the submit button label:
<?php
function YOUR_MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
// echo $form_id; // You can check the form_id by print the $form_id variable.
switch ($form_id) {
case 'views_exposed_form':
$form['submit']['#value'] = t('Search'); // Change the label of submit button to search.
break;
}
}
?>
hook_form_alter() is used to perform alterations before a form is rendered.
function YOUR_MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
// echo $form_id; // You can check the form_id by print the $form_id variable.
switch ($form_id) {
case 'views_exposed_form':
$form['submit']['#value'] = t('Search'); // Change the label of submit button to search.
break;
}
}
?>