FormTestAlterForm.php

Same filename in other branches
  1. 9 core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php
  2. 8.9.x core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php
  3. 11.x core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php

Namespace

Drupal\form_test\Form

File

core/modules/system/tests/modules/form_test/src/Form/FormTestAlterForm.php

View source
<?php

namespace Drupal\form_test\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Form builder for testing hook_form_alter() and hook_form_FORM_ID_alter().
 *
 * @internal
 */
class FormTestAlterForm extends FormBase {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'form_test_alter_form';
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state) {
        // Elements can be added as needed for future testing needs, but for now,
        // we're only testing alter hooks that do not require any elements added by
        // this function.
        return $form;
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
    }

}

Classes

Title Deprecated Summary
FormTestAlterForm Form builder for testing hook_form_alter() and hook_form_FORM_ID_alter().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.