You are here

public function FeedsFeedNodeProcessor::configForm in Feeds 6

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

Override parent::configForm().

Overrides FeedsConfigurable::configForm

File

plugins/FeedsFeedNodeProcessor.inc, line 116
Class definition of FeedsFeedNodeProcessor.

Class

FeedsFeedNodeProcessor
Creates *feed* nodes from feed items. The difference to FeedsNodeProcessor is that this plugin only creates nodes that are feed nodes themselves.

Code

public function configForm(&$form_state) {
  $feeds = feeds_importer_load_all();
  $types = array();
  foreach ($feeds as $feed) {
    if ($feed->id != $this->id && !empty($feed->config['content_type'])) {
      $types[$feed->config['content_type']] = node_get_types('name', $feed->config['content_type']);
    }
  }
  if (empty($types)) {
    $types[''] = t('No feed node content type available');
  }
  else {
    $types = array(
      '' => t('Select'),
    ) + $types;
  }
  $form = array();
  $form['content_type'] = array(
    '#type' => 'select',
    '#title' => t('Content type'),
    '#description' => t('Choose node type to create from this feed. Only node types with attached importer configurations are listed here. <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. However, users with "clear !feed_id permissions" need to have sufficient node level permissions to delete the imported nodes.', array(
      '!feed_id' => $this->id,
    )),
    '#options' => $types,
    '#default_value' => $this->config['content_type'],
  );

  // @todo Implement real updating.
  $form['update_existing'] = array(
    '#type' => 'checkbox',
    '#title' => t('Replace existing feed nodes'),
    '#description' => t('If an existing node is found for an imported node, replace it. Existing nodes will be determined using mappings that are a "unique target".'),
    '#default_value' => $this->config['update_existing'],
  );
  return $form;
}