public OpmlFeedAdd::buildForm(array $form, FormStateInterface $form_state)
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
- core/modules/aggregator/src/Form/OpmlFeedAdd.php, line 65
Class
- OpmlFeedAdd
- Imports feeds from OPML.
Namespace
Drupal\aggregator\Form
Code
public function buildForm(array $form, FormStateInterface $form_state) { $intervals = array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200); $period = array_map(array(\Drupal::service('date.formatter'), 'formatInterval'), array_combine($intervals, $intervals)); $form['upload'] = array( '#type' => 'file', '#title' => $this->t('OPML File'), '#description' => $this->t('Upload an OPML file containing a list of feeds to be imported.'), ); $form['remote'] = array( '#type' => 'url', '#title' => $this->t('OPML Remote URL'), '#maxlength' => 1024, '#description' => $this->t('Enter the URL of an OPML file. This file will be downloaded and processed only once on submission of the form.'), ); $form['refresh'] = array( '#type' => 'select', '#title' => $this->t('Update interval'), '#default_value' => 3600, '#options' => $period, '#description' => $this->t('The length of time between feed updates. Requires a correctly configured <a href=":cron">cron maintenance task</a>.', array(':cron' => $this->url('system.status'))), ); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => $this->t('Import'), ); return $form; }
Please login to continue.