You are here

public function GroupAddForm::form in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_server/src/Form/GroupAddForm.php \Drupal\entity_share_server\Form\GroupAddForm::form()
  2. 8.2 modules/entity_share_server/src/Form/GroupAddForm.php \Drupal\entity_share_server\Form\GroupAddForm::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

modules/entity_share_server/src/Form/GroupAddForm.php, line 17

Class

GroupAddForm
Class GroupAddForm.

Namespace

Drupal\entity_share_server\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['group_id'] = [
    '#type' => 'machine_name',
    '#title' => $this
      ->t('ID'),
    '#machine_name' => [
      'exists' => [
        $this,
        'groupExists',
      ],
    ],
  ];
  $form['conjunction'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Conjunction'),
    '#options' => $this
      ->getConjunctionOptions(),
    '#default_value' => 'AND',
    '#required' => TRUE,
  ];
  $form['memberof'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Parent group'),
    '#options' => $this
      ->getGroupOptions(),
    '#empty_option' => $this
      ->t('Select a group'),
  ];
  return $form;
}