Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Shyamala on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Introduced in version:
8.0.0-alpha14
Issue links:
Description:
Summary
- Drupal 7, forms were built by a procedural function, and validation and submission were named functions.
- In Drupal 8, there is now an interface called FormInterface with four methods:
getFormID(), buildForm(), validateForm(), submitForm() - Refer FormInterface Change Request at: https://drupal.org/node/1932058
- This change request cleans up drupal_get_form() to initiate an existing or new class name
Before
drupal_get_form(new SearchBlockForm());
drupal_get_form(ConfirmDeleteMultiple::create(\Drupal::getContainer()));
drupal_get_form
was used as - return drupal_get_form(new SearchBlockForm(), $this->request);
After
drupal_get_form('Drupal\comment\Form\ConfirmDeleteMultiple');
drupal_get_form('Drupal\search\Form\SearchBlockForm');
drupal_get_form
now used as - return drupal_get_form('Drupal\search\Form\SearchBlockForm');
Impacts:
Module developers