public function ClusterForm::form in Elasticsearch Connector 8.6
Same name and namespace in other branches
- 8.7 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
- 8 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
- 8.2 src/Form/ClusterForm.php \Drupal\elasticsearch_connector\Form\ClusterForm::form()
- 8.5 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 56
Class
- ClusterForm
- Provides a form for the Cluster entity.
Namespace
Drupal\elasticsearch_connector\FormCode
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;
}