You are here

public function CrossdomainFormController::form in Crossdomain 8

Builds the form.

File

lib/Drupal/crossdomain/Controller/CrossdomainFormController.php, line 31

Class

CrossdomainFormController

Namespace

Drupal\crossdomain\Controller

Code

public function form(array $form, array &$form_state) {
  $form = parent::form($form, $form_state);
  $domain = $this->entity;
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Domain'),
    '#maxlength' => 255,
    '#default_value' => $domain
      ->label(),
    '#description' => $this
      ->t('Domain to add to the xml file.'),
    '#required' => TRUE,
  );
  $form['id'] = array(
    '#type' => 'machine_name',
    '#default_value' => $domain
      ->id(),
    '#machine_name' => array(
      'exists' => array(
        $this,
        'exists',
      ),
    ),
    '#disabled' => !$domain
      ->isNew(),
  );

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