You are here

public function SearchAddForm::form in Entity Share 8.3

Same name and namespace in other branches
  1. 8.2 modules/entity_share_server/src/Form/SearchAddForm.php \Drupal\entity_share_server\Form\SearchAddForm::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/SearchAddForm.php, line 19

Class

SearchAddForm
Form to add a search on a channel.

Namespace

Drupal\entity_share_server\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['path'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Path'),
    '#description' => $this
      ->t('Enter the machine name of the field / property you want to be able to search in, on the client website. You can reference field / property of a referenced entity. Example: uid.name for the name of the author.'),
    '#required' => TRUE,
  ];
  $form['search_id'] = [
    '#type' => 'machine_name',
    '#title' => $this
      ->t('ID'),
    '#machine_name' => [
      'source' => [
        'path',
      ],
      'exists' => [
        $this,
        'searchExists',
      ],
    ],
  ];
  $form['search_label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#required' => TRUE,
  ];
  return $form;
}