public function ImportForm::buildForm in Feed Import 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ ImportForm.php, line 25 - Contains \Drupal\feed_import\Form\ImportForm
Class
Namespace
Drupal\feed_import\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Feed name'),
'#maxlength' => 64,
'#description' => t('This usually is source name.'),
'#required' => TRUE,
);
$form['machine_name'] = array(
'#type' => 'machine_name',
'#title' => t('Feed machine name'),
'#description' => t('This must be unique for each feed and must be not numeric.') . '<br />' . t('Once saved this can not be changed!'),
'#maxlength' => 64,
'#required' => TRUE,
'#machine_name' => array(
'source' => array(
'name',
),
'exists' => '\\Drupal\\feed_import_base\\FeedImport::loadFeed',
),
);
$form['code'] = array(
'#type' => 'textarea',
'#rows' => 10,
'#title' => t('Enter feed in JSON format'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Import'),
);
return $form;
}