You are here

public function FeedsNodeProcessor::configForm in Feeds 6

Same name and namespace in other branches
  1. 7.2 plugins/FeedsNodeProcessor.inc \FeedsNodeProcessor::configForm()
  2. 7 plugins/FeedsNodeProcessor.inc \FeedsNodeProcessor::configForm()

Override parent::configForm().

Overrides FeedsConfigurable::configForm

File

plugins/FeedsNodeProcessor.inc, line 174
Class definition of FeedsNodeProcessor.

Class

FeedsNodeProcessor
Creates nodes from feed items.

Code

public function configForm(&$form_state) {
  $types = node_get_types('names');
  $form = array();
  $form['content_type'] = array(
    '#type' => 'select',
    '#title' => t('Content type'),
    '#description' => t('Select the content type for the nodes to be created. <strong>Note:</strong> Users with "import !feed_id feeds" permissions will be able to <strong>import</strong> nodes of the content type selected here regardless of the node level permissions. Further, users with "clear !feed_id permissions" will be able to <strong>delete</strong> imported nodes regardless of their node level permissions.', array(
      '!feed_id' => $this->id,
    )),
    '#options' => $types,
    '#default_value' => $this->config['content_type'],
  );
  $format_options = array(
    FILTER_FORMAT_DEFAULT => t('Default format'),
  );
  $formats = filter_formats();
  foreach ($formats as $format) {
    $format_options[$format->format] = $format->name;
  }
  $form['input_format'] = array(
    '#type' => 'select',
    '#title' => t('Input format'),
    '#description' => t('Select the input format for the body field of the nodes to be created.'),
    '#options' => $format_options,
    '#default_value' => $this->config['input_format'],
  );
  $author = user_load(array(
    'uid' => $this->config['author'],
  ));
  $form['author'] = array(
    '#type' => 'textfield',
    '#title' => t('Author'),
    '#description' => t('Select the author of the nodes to be created - leave empty to assign "anonymous".'),
    '#autocomplete_path' => 'user/autocomplete',
    '#default_value' => empty($author->name) ? 'anonymous' : check_plain($author->name),
  );
  $form['authorize'] = array(
    '#type' => 'checkbox',
    '#title' => t('Authorize'),
    '#description' => t('Check that the author has permission to create the node.'),
    '#default_value' => $this->config['authorize'],
  );
  $period = drupal_map_assoc(array(
    FEEDS_EXPIRE_NEVER,
    3600,
    10800,
    21600,
    43200,
    86400,
    259200,
    604800,
    604800 * 4,
    604800 * 12,
    604800 * 24,
    31536000,
  ), 'feeds_format_expire');
  $form['expire'] = array(
    '#type' => 'select',
    '#title' => t('Expire nodes'),
    '#options' => $period,
    '#description' => t('Select after how much time nodes should be deleted. The node\'s published date will be used for determining the node\'s age, see Mapping settings.'),
    '#default_value' => $this->config['expire'],
  );
  $form['update_existing'] = array(
    '#type' => 'radios',
    '#title' => t('Update existing nodes'),
    '#description' => t('Select how existing nodes should be updated. Existing nodes will be determined using mappings that are a "unique target".'),
    '#options' => array(
      FEEDS_SKIP_EXISTING => 'Do not update existing nodes',
      FEEDS_REPLACE_EXISTING => 'Replace existing nodes',
      FEEDS_UPDATE_EXISTING => 'Update existing nodes (slower than replacing them)',
    ),
    '#default_value' => $this->config['update_existing'],
  );
  $form['skip_hash_check'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip hash check'),
    '#description' => t('Force update of items even if item source data did not change.'),
    '#default_value' => $this->config['skip_hash_check'],
  );
  return $form;
}