public function FormTestControllerObject::buildForm

Implements \Drupal\Core\Form\FormInterface::buildForm().

Overrides FormInterface::buildForm

File

drupal/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestControllerObject.php, line 38
Contains \Drupal\form_test\FormTestControllerObject.

Class

FormTestControllerObject
Provides a test form object.

Namespace

Drupal\form_test

Code

public function buildForm(array $form, array &$form_state, $custom_attributes = NULL, Request $request = NULL) {
  $form['element'] = array(
    '#markup' => 'The FormTestControllerObject::buildForm() method was used for this form.',
  );
  $form['custom_attribute']['#markup'] = $custom_attributes;
  $form['request_attribute']['#markup'] = $request->attributes
    ->get('request_attribute');
  $form['bananas'] = array(
    '#type' => 'textfield',
    '#title' => t('Bananas'),
  );
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}