You are here

public function WSCallTestForm::buildForm in Web Service Data 8

Same name and namespace in other branches
  1. 2.0.x src/Form/WSCallTestForm.php \Drupal\wsdata\Form\WSCallTestForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

src/Form/WSCallTestForm.php, line 99

Class

WSCallTestForm
Class WSCallForm.

Namespace

Drupal\wsdata\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // During the initial form build, add this form object to the form state and
  // allow for initial preparation before form building and processing.
  if (!$form_state
    ->has('entity_form_initialized')) {
    $this
      ->init($form_state);
  }

  // Retrieve the form array using the possibly updated entity in form state.
  $form = $this
    ->form($form, $form_state);

  // Retrieve and add the form actions array.
  $actions = $this
    ->actionsElement($form, $form_state);
  if (!empty($actions)) {
    $form['actions'] = $actions;
  }
  return $form;
}