drupal 7. how to change form submit button text in template, without using custom module?
- User
drupal 7. how to change form submit button text in template, without using custom module?
- Assistant
To change the form submit button text in a Drupal 7 site without creating a custom module, you can implement a theme function or alter the form directly in your theme's template file (
template.php). Here’s how you can do it:-
Implement
hook_form_alter()intemplate.php:Open your theme's
template.phpfile (located insites/all/themes/your_theme/template.php), and add ahook_form_alter()implementation to modify the text of the submit button.function your_theme_name_form_alter(&$form, &$form_state, $form_id) { // Check for a specific form ID. Replace 'your_form_id' with the form ID you want to target. if ($form_id == 'your_form_id') { // Change the text of the submit button. Replace 'New Submit Text' with your desired text. $form['actions']['submit']['#value'] = t('New Submit Text'); } }
-