You are here

public function FeedsNodeProcessor::configForm in Feeds 7

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

Override parent::configForm().

Overrides FeedsConfigurable::configForm

File

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

Class

FeedsNodeProcessor
Creates nodes from feed items.

Code

public function configForm(&$form_state) {
  $types = node_type_get_names();
  array_walk($types, 'check_plain');
  $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(
    FEEDS_NODE_DEFAULT_FORMAT => t('Default format'),
  );
  global $user;
  $formats = filter_formats($user);
  foreach ($formats as $format) {
    $format_options[$format->format] = check_plain($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($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),
  );
  $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'],
  );
  return $form;
}