You are here

public function FeedsCrawler::sourceForm in Feeds Crawler 7

Same name and namespace in other branches
  1. 6.2 FeedsCrawler.inc \FeedsCrawler::sourceForm()

Overrides parent::sourceForm().

1 call to FeedsCrawler::sourceForm()
FeedsCrawler::configForm in ./FeedsCrawler.inc
Overrides parent::configForm().

File

./FeedsCrawler.inc, line 172
Home of the FeedsCrawler.

Class

FeedsCrawler
Fetches data via HTTP.

Code

public function sourceForm($source_config) {
  $form = parent::sourceForm($source_config);
  $form['crawler'] = array(
    '#type' => 'fieldset',
    '#title' => t('Feeds Crawler settings'),
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
    '#tree' => TRUE,
  );
  $form['crawler']['num_pages'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of pages'),
    '#description' => t('The number of pages to fetch. 0 for unlimited'),
    '#default_value' => isset($source_config['crawler']['num_pages']) ? $source_config['crawler']['num_pages'] : 10,
    '#maxlength' => 10,
  );
  $form['crawler']['delay'] = array(
    '#type' => 'textfield',
    '#title' => t('Delay'),
    '#description' => t('Number of seconds to delay in between fetches.'),
    '#default_value' => isset($source_config['crawler']['delay']) ? $source_config['crawler']['delay'] : 1,
  );
  $form['crawler']['first_run'] = array(
    '#type' => 'checkbox',
    '#title' => t('Crawl on first run only'),
    '#description' => t('Only crawl on initial run. Use regular import afterword.'),
    '#default_value' => isset($source_config['crawler']['first_run']) ? $source_config['crawler']['first_run'] : FALSE,
  );
  $form['crawler']['auto'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto detect next link'),
    '#description' => t('Attempt to autodetect the next link for RSS and ATOM feeds.'),
    '#default_value' => isset($source_config['crawler']['auto']) ? $source_config['crawler']['auto'] : FALSE,
  );
  $form['crawler']['xpath'] = array(
    '#type' => 'textfield',
    '#title' => t('XPath selector for next link'),
    '#description' => t('The XPath selector for the next link.'),
    '#default_value' => isset($source_config['crawler']['xpath']) ? $source_config['crawler']['xpath'] : '',
    '#maxlength' => NULL,
  );
  $form['crawler']['url'] = array(
    '#type' => 'fieldset',
    '#title' => t('URL replacement options'),
  );
  $form['crawler']['url']['url_pattern'] = array(
    '#type' => 'textfield',
    '#title' => t('URL pattern'),
    '#description' => t('A URL with the variable $index replaced with an increnting number. For example: http://example.com?page=$index.'),
    '#default_value' => isset($source_config['crawler']['url']['url_pattern']) ? $source_config['crawler']['url']['url_pattern'] : '',
    '#maxlength' => NULL,
  );
  $form['crawler']['url']['initial'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial value of $index'),
    '#description' => t('The initial value of the $index variable.'),
    '#default_value' => isset($source_config['crawler']['url']['initial']) ? $source_config['crawler']['url']['initial'] : '',
  );
  $form['crawler']['url']['increment'] = array(
    '#type' => 'textfield',
    '#title' => t('Increment $index by'),
    '#description' => t('The increment the value of $index variable.'),
    '#default_value' => isset($source_config['crawler']['url']['increment']) ? $source_config['crawler']['url']['increment'] : '',
  );
  $form['crawled'] = array(
    '#type' => 'hidden',
    '#value' => isset($source_config['crawled']) ? $source_config['crawled'] : FALSE,
  );
  return $form;
}