You are here

public function ClusterForm::form in Elasticsearch Connector 8.2

Same name and namespace in other branches
  1. 8.7 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
  2. 8 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
  3. 8.5 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
  4. 8.6 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/ClusterForm.php, line 48
Contains Drupal\elasticsearch_connector\Form.

Class

ClusterForm
Provides a form for the Cluster entity.

Namespace

Drupal\elasticsearch_connector\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  if ($form_state
    ->isRebuilding()) {
    $this->entity = $this
      ->buildEntity($form, $form_state);
  }
  $form = parent::form($form, $form_state);
  if ($this->entity
    ->isNew()) {
    $form['#title'] = $this
      ->t('Add Elasticsearch Cluster');
  }
  else {
    $form['#title'] = $this
      ->t('Edit Elasticsearch Cluster @label', array(
      '@label' => $this->entity
        ->label(),
    ));
  }
  $this
    ->buildEntityForm($form, $form_state);
  return $form;
}