public function SolrFieldTypeExportForm::form in Search API Multilingual Solr Search 8
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/ SolrFieldTypeExportForm.php, line 16
Class
- SolrFieldTypeExportForm
- Builds the form to export a SolrFieldType.
Namespace
Drupal\search_api_solr_multilingual\FormCode
public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\search_api_solr_multilingual\Entity\SolrFieldType $solr_field_type */
$solr_field_type = $this->entity;
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $solr_field_type
->id(),
'#machine_name' => array(
'exists' => '\\Drupal\\search_api_solr_multilingual\\Entity\\SolrFieldType::load',
),
'#disabled' => TRUE,
);
$form['field_type'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Field Type'),
);
$form['field_type']['json'] = array(
'#type' => 'textarea',
'#title' => $this
->t('JSON'),
'#description' => $this
->t('JSON representation to be used for solr REST API and managed schemas.'),
'#default_value' => $solr_field_type
->getFieldTypeAsJson(),
'#disabled' => TRUE,
);
$form['field_type']['xml'] = array(
'#type' => 'textarea',
'#title' => $this
->t('XML'),
'#description' => $this
->t('XML representation to be used as part of schema.xml.'),
'#default_value' => $solr_field_type
->getFieldTypeAsXml(),
'#disabled' => FALSE,
);
$form['text_files'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Text Files'),
);
$text_files = $solr_field_type
->getTextFiles();
foreach ($text_files as $text_file_name => $text_file) {
$form['text_files'][$text_file_name] = array(
'#type' => 'textarea',
'#title' => $text_file_name,
'#default_value' => $text_file,
'#disabled' => TRUE,
);
}
return $form;
}