Information for: DEVELOPERS   PARTNERS

Alter an existing simple form

Fast Track to Drupal 8 Coding`Back to Intro </tutorials/fast-track-drupal-8-coding/>`__
Previous lesson – `Create a custom block </tutorials/fast-track-drupal-8-coding/create-custom-block/>`__  |  Next lesson – `Build a new form </tutorials/fast-track-drupal-8-coding/build-new-form/>`__

Lesson Goal

Change the label of a comment form button to Add Comment.

Implementation Method

Drupal Version

Method

Drupal 7

Use hook_form_alter

Drupal 8

Use hook_form_alter

Drupal 7 method

Add the following code to the lotus.module file:


Drupal 8 method

Add the following code to the lotus.module file: