Last active
April 11, 2018 08:49
-
-
Save gauravgoyal/809b13e2901ef4a4c9bb8472ca60a385 to your computer and use it in GitHub Desktop.
Task-11: Alter an existing simple form
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
<?php | |
/** | |
* @file | |
* Change the label of Comment form button to 'Add Comment' | |
*/ | |
use Drupal\Core\Form\FormStateInterface; | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function example_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
if ($form_id == 'comment_comment_form') { | |
$form['actions']['submit']['#value'] = t('Add Comment'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment