You are here

public function FeedsImporter::configForm in Feeds 7

Same name and namespace in other branches
  1. 6 includes/FeedsImporter.inc \FeedsImporter::configForm()
  2. 7.2 includes/FeedsImporter.inc \FeedsImporter::configForm()

Override parent::configForm().

Overrides FeedsConfigurable::configForm

File

includes/FeedsImporter.inc, line 223
FeedsImporter class and related.

Class

FeedsImporter
A FeedsImporter object describes how an external source should be fetched, parsed and processed. Feeds can manage an arbitrary amount of importers.

Code

public function configForm(&$form_state) {
  $form = array();
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#description' => t('The name of this configuration.'),
    '#default_value' => $this->config['name'],
    '#required' => TRUE,
  );
  $form['description'] = array(
    '#type' => 'textfield',
    '#title' => t('Description'),
    '#description' => t('A description of this configuration.'),
    '#default_value' => $this->config['description'],
  );
  $node_types = node_type_get_names();
  array_walk($node_types, 'check_plain');
  $form['content_type'] = array(
    '#type' => 'select',
    '#title' => t('Attach to content type'),
    '#description' => t('If an importer is attached to a content type, content is imported by creating a node. If the standalone form is selected, content is imported by using the standalone form under http://example.com/import.'),
    '#options' => array(
      '' => t('Use standalone form'),
    ) + $node_types,
    '#default_value' => $this->config['content_type'],
  );
  $period = drupal_map_assoc(array(
    0,
    900,
    1800,
    3600,
    10800,
    21600,
    43200,
    86400,
    259200,
    604800,
    2419200,
  ), 'format_interval');
  $period[FEEDS_SCHEDULE_NEVER] = t('Never');
  $period[0] = t('As often as possible');
  $form['import_period'] = array(
    '#type' => 'select',
    '#title' => t('Minimum refresh period'),
    '#options' => $period,
    '#description' => t('This is the minimum time that must elapse before a feed may be refreshed automatically.'),
    '#default_value' => $this->config['import_period'],
  );
  $form['import_on_create'] = array(
    '#type' => 'checkbox',
    '#title' => t('Import on submission'),
    '#description' => t('Check if content should be imported at the moment of feed submission.'),
    '#default_value' => $this->config['import_on_create'],
  );
  return $form;
}