You are here

public function ConditionalFieldForm::buildForm in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 src/Form/ConditionalFieldForm.php \Drupal\conditional_fields\Form\ConditionalFieldForm::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 FormInterface::buildForm

File

src/Form/ConditionalFieldForm.php, line 140

Class

ConditionalFieldForm
A form with a list of conditional fields for an entity type.

Namespace

Drupal\conditional_fields\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $entity_type = NULL, $bundle = NULL) {
  $this->form = $form;
  $this->form_state = $form_state;
  $this->entity_type = $entity_type;
  $this->bundle_name = $bundle;
  $this->form['entity_type'] = [
    '#type' => 'hidden',
    '#value' => $this->entity_type,
  ];
  $this->form['bundle'] = [
    '#type' => 'hidden',
    '#value' => $this->bundle_name,
  ];
  $this
    ->buildTable();
  return $this->form;
}