You are here

function feedapi_node_feedapi_settings_form in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi_node/feedapi_node.module \feedapi_node_feedapi_settings_form()

Implementation of hook_feedapi_settings_form(). If a module provides parsers and processors it MUST evaluate the $type variable to return different forms for parsers and processors. There might be a better term for parsers and processors than $type.

File

feedapi_node/feedapi_node.module, line 107
Handle how the feed items are represented as a content Handle the processing of the feed items

Code

function feedapi_node_feedapi_settings_form($type) {
  $form = array();
  switch ($type) {
    case 'processors':
      $ct_types = node_get_types();
      $ct_options = array();
      if (is_array($ct_types)) {
        foreach ($ct_types as $key => $data) {
          if (!feedapi_enabled_type($key)) {
            $ct_options[$key] = $data->name;
          }
        }
      }
      if (array_key_exists('story', $ct_options)) {
        $default_type = 'story';
      }
      else {
        $default_type = current(array_keys($ct_options));
      }
      $form['content_type'] = array(
        '#type' => 'select',
        '#title' => t('Node type of feed items'),
        '#default_value' => $default_type,
        '#options' => $ct_options,
        '#description' => t('Choose the node type for feed item nodes created by this feed.'),
      );
      $form['node_date'] = array(
        '#type' => 'radios',
        '#title' => t('Created date of item nodes'),
        '#options' => array(
          'feed' => t('Retrieve from feed'),
          'current' => t('Use time of download'),
        ),
        '#default_value' => 'feed',
      );
      $form['promote'] = array(
        '#type' => 'textfield',
        '#title' => t('Promoted items'),
        '#description' => t('The newest N items per feed will be promoted to front page. Leave empty and FeedAPI does not alter the promote property of the feed items.'),
        '#default_value' => 3,
      );
      $form['x_dedupe'] = array(
        '#type' => 'radios',
        '#title' => t('Duplicates'),
        '#description' => t('If you choose "check for duplicates on all feeds", a feed item will not be created if it already exists on *ANY* feed. Instead, the existing feed item will be linked to the feed. If you are not sure, choose the first option.'),
        '#options' => array(
          0 => t('Check for duplicates only within feed'),
          1 => t('Check for duplicates on all feeds'),
        ),
        '#default_value' => 0,
      );
      break;
  }
  return $form;
}