You are here

function feedapi_node_feedapi_settings_form in FeedAPI 6

Same name and namespace in other branches
  1. 5 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 164
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(
        '' => t('Select type'),
      );
      if (is_array($ct_types)) {
        foreach ($ct_types as $key => $data) {
          if (!feedapi_enabled_type($key)) {
            $ct_options[$key] = $data->name;
          }
        }
      }
      $form['content_type'] = array(
        '#type' => 'select',
        '#title' => t('Node type of feed items'),
        '#default_value' => '',
        '#options' => $ct_options,
        '#description' => t('Choose the node type for feed item nodes created by this feed.'),
      );
      $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 for feed items'),
        '#default_value' => FILTER_FORMAT_DEFAULT,
        '#options' => $format_options,
        '#description' => t('Choose the input format 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['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;
}