You are here

public function FeedsHTTPFetcher::sourceFormValidate in Feeds 8.2

Override parent::sourceFormValidate().

Overrides FeedsPlugin::sourceFormValidate

File

lib/Drupal/feeds/Plugin/feeds/fetcher/FeedsHTTPFetcher.php, line 154
Contains \Drupal\feeds\Plugin\feeds\fetcher\FeedsHTTPFetcher.

Class

FeedsHTTPFetcher
Defines an HTTP fetcher.

Namespace

Drupal\feeds\Plugin\feeds\fetcher

Code

public function sourceFormValidate(&$values) {
  $values['source'] = trim($values['source']);
  if (!feeds_valid_url($values['source'], TRUE)) {
    $form_key = 'feeds][' . get_class($this) . '][source';
    form_set_error($form_key, t('The URL %source is invalid.', array(
      '%source' => $values['source'],
    )));
  }
  elseif ($this->config['auto_detect_feeds']) {
    feeds_include_library('http_request.inc', 'http_request');
    if ($url = http_request_get_common_syndication($values['source'])) {
      $values['source'] = $url;
    }
  }
}