public function IndexForm::buildEntityForm in Elasticsearch Connector 8.2
Same name and namespace in other branches
- 8.7 src/Form/IndexForm.php \Drupal\elasticsearch_connector\Form\IndexForm::buildEntityForm()
- 8 src/Form/IndexForm.php \Drupal\elasticsearch_connector\Form\IndexForm::buildEntityForm()
- 8.5 src/Form/IndexForm.php \Drupal\elasticsearch_connector\Form\IndexForm::buildEntityForm()
- 8.6 src/Form/IndexForm.php \Drupal\elasticsearch_connector\Form\IndexForm::buildEntityForm()
1 call to IndexForm::buildEntityForm()
- IndexForm::form in src/
Form/ IndexForm.php - Gets the actual form array to be built.
File
- src/
Form/ IndexForm.php, line 163 - Contains \Drupal\elasticsearch_connector\Form\IndexForm.
Class
- IndexForm
- Form controller for node type forms.
Namespace
Drupal\elasticsearch_connector\FormCode
public function buildEntityForm(array &$form, FormStateInterface $form_state) {
$form['index'] = array(
'#type' => 'value',
'#value' => $this->entity,
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Index name'),
'#required' => TRUE,
'#default_value' => '',
'#description' => t('Enter the index name.'),
);
$form['index_id'] = array(
'#type' => 'machine_name',
'#title' => t('Index id'),
'#default_value' => '',
'#maxlength' => 125,
'#description' => t('Unique, machine-readable identifier for this Index'),
'#machine_name' => array(
'exists' => array(
$this
->getIndexStorage(),
'load',
),
'source' => array(
'name',
),
'replace_pattern' => '[^a-z0-9_]+',
'replace' => '_',
),
'#required' => TRUE,
'#disabled' => !empty($this->entity->index_id),
);
// Here server refers to the elasticsearch cluster.
$form['server'] = array(
'#type' => 'radios',
'#title' => $this
->t('Server'),
'#default_value' => !empty($this->entity->server) ? $this->entity->server : Cluster::getDefaultCluster(),
'#description' => $this
->t('Select the server this index should reside on. Index can not be enabled without connection to valid server.'),
'#options' => $this
->getClusterField('cluster_id'),
'#weight' => 9,
'#required' => TRUE,
);
$form['num_of_shards'] = array(
'#type' => 'textfield',
'#title' => t('Number of shards'),
'#required' => TRUE,
'#default_value' => 5,
'#description' => t('Enter the number of shards for the index.'),
);
$form['num_of_replica'] = array(
'#type' => 'textfield',
'#title' => t('Number of replica'),
'#default_value' => 1,
'#description' => t('Enter the number of shards replicas.'),
);
}