You are here

public function FeedImporterAddForm::form in Feed Import 8

Same name in this branch
  1. 8 src/Form/FeedImporterAddForm.old.php \Drupal\feed_import\Form\FeedImporterAddForm::form()
  2. 8 src/Form/FeedImporterAddForm.php \Drupal\feed_import\Form\FeedImporterAddForm::form()

Gets the actual form array to be built.

Overrides FeedImporterFormBase::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/FeedImporterAddForm.php, line 17

Class

FeedImporterAddForm
Form for adding a feed importer.

Namespace

Drupal\feed_import\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['entity'] = [
    '#type' => 'select',
    '#options' => FeedImport::getAllEntities(),
    '#default_value' => 'node',
    '#title' => $this
      ->t('Entity name'),
    '#description' => $this
      ->t('Entity where you want to import content. Ex: node, user, ...'),
    '#maxlength' => 64,
    '#required' => TRUE,
  ];
  $form['cron_import'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Import at cron'),
    '#default_value' => FALSE,
    '#description' => $this
      ->t('Check this if you want to import feed items when cron runs.'),
  ];
  return $form;
}