You are here

public function TextFileForm::form in Apache Solr Config Generator 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/TextFileForm.php, line 23
Contains Drupal\apachesolr_confgen\Form\TextFileForm.

Class

TextFileForm
Class TextFileForm.

Namespace

Drupal\apachesolr_confgen\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $solr_text_file = $this->entity;
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $solr_text_file
      ->label(),
    '#description' => $this
      ->t("Label for the TextFile."),
    '#required' => TRUE,
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#default_value' => $solr_text_file
      ->id(),
    '#machine_name' => array(
      'exists' => '\\Drupal\\apachesolr_confgen\\Entity\\TextFile::load',
    ),
    '#disabled' => !$solr_text_file
      ->isNew(),
  );

  /* You will need additional form elements for your custom properties. */
  return $form;
}