You are here

public function FeedsCrawlerPattern::sourceForm in Feeds Crawler 7.2

Overrides FeedsCrawlerBase::sourceForm

File

src/FeedsCrawlerPattern.php, line 85
Contains FeedsCrawlerPattern.

Class

FeedsCrawlerPattern
Crawls links using a URL pattern.

Code

public function sourceForm($source_config) {
  $form = parent::sourceForm($source_config);
  $form['pattern'] = array(
    '#type' => 'textfield',
    '#title' => t('Pattern'),
    '#description' => t('The URL pattern.'),
    '#default_value' => isset($source_config['pattern']) ? $source_config['pattern'] : '{full_path}?page={index}',
  );
  $form['initial_index'] = array(
    '#type' => 'textfield',
    '#title' => t('Initial index'),
    '#description' => t('The initial index value.'),
    '#default_value' => isset($source_config['initial_index']) ? $source_config['initial_index'] : 0,
    '#element_validate' => array(
      'element_validate_number',
    ),
  );
  $form['increment'] = array(
    '#type' => 'textfield',
    '#title' => t('Increment'),
    '#description' => t('The amount to increment the index.'),
    '#default_value' => isset($source_config['increment']) ? $source_config['increment'] : 1,
    '#element_validate' => array(
      'element_validate_number',
    ),
  );
  return $form;
}