You are here

public function FeedsFileFetcher::sourceForm in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsFileFetcher.inc \FeedsFileFetcher::sourceForm()
  2. 7 plugins/FeedsFileFetcher.inc \FeedsFileFetcher::sourceForm()

Source form.

Overrides FeedsPlugin::sourceForm

File

plugins/FeedsFileFetcher.inc, line 97
Home of the FeedsFileFetcher and related classes.

Class

FeedsFileFetcher
Fetches data via HTTP.

Code

public function sourceForm($source_config) {
  $form = array();
  $form['fid'] = array(
    '#type' => 'value',
    '#value' => empty($source_config['fid']) ? 0 : $source_config['fid'],
  );
  if (empty($this->config['direct'])) {
    $form['source'] = array(
      '#type' => 'value',
      '#value' => empty($source_config['source']) ? '' : $source_config['source'],
    );
    $form['upload'] = array(
      '#type' => 'file',
      '#title' => empty($this->config['direct']) ? t('File') : NULL,
      '#description' => empty($source_config['source']) ? t('Select a file from your local system.') : t('Select a different file from your local system.'),
      '#theme_wrappers' => array(
        'feeds_upload',
      ),
      '#file_info' => empty($source_config['fid']) ? NULL : file_load($source_config['fid']),
      '#size' => 10,
    );
  }
  else {
    $form['source'] = array(
      '#type' => 'textfield',
      '#title' => t('File'),
      '#description' => t('Specify a path to a file or a directory. Prefix the path with a scheme. Available schemes: @schemes.', array(
        '@schemes' => implode(', ', $this->config['allowed_schemes']),
      )),
      '#default_value' => empty($source_config['source']) ? '' : $source_config['source'],
    );
  }
  return $form;
}