You are here

public function FeedsFileFetcher::configForm in Feeds 7.2

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

Overrides parent::configForm().

Overrides FeedsConfigurable::configForm

File

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

Class

FeedsFileFetcher
Fetches data via HTTP.

Code

public function configForm(&$form_state) {
  $form = array();
  $form['allowed_extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed file extensions'),
    '#description' => t('Allowed file extensions for upload.'),
    '#default_value' => $this->config['allowed_extensions'],
  );
  $form['delete_uploaded_file'] = array(
    '#type' => 'checkbox',
    '#title' => t('Immediately delete uploaded file after import'),
    '#description' => t('Useful if the file contains private information. If not selected, the file will remain on the server, allowing the import to be re-run without having to upload it again. This setting has no effect when the option "@direct" is enabled.', array(
      '@direct' => t('Supply path to file or directory directly'),
    )),
    '#default_value' => $this->config['delete_uploaded_file'],
    '#states' => array(
      'disabled' => array(
        ':input[name="direct"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['direct'] = array(
    '#type' => 'checkbox',
    '#title' => t('Supply path to file or directory directly'),
    '#description' => t('For experts. Lets users specify a path to a file <em>or a directory of files</em> directly,
        instead of a file upload through the browser. This is useful when the files that need to be imported
        are already on the server.'),
    '#default_value' => $this->config['direct'],
  );
  $form['directory'] = array(
    '#type' => 'textfield',
    '#title' => t('Upload directory'),
    '#description' => t('Directory where uploaded files get stored. Prefix the path with a scheme. Available schemes: @schemes.', array(
      '@schemes' => implode(', ', $this
        ->getSchemes()),
    )),
    '#default_value' => $this->config['directory'],
    '#states' => array(
      'visible' => array(
        ':input[name="direct"]' => array(
          'checked' => FALSE,
        ),
      ),
      'required' => array(
        ':input[name="direct"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  if ($options = $this
    ->getSchemeOptions()) {
    $form['allowed_schemes'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Allowed schemes'),
      '#default_value' => $this->config['allowed_schemes'],
      '#options' => $options,
      '#description' => t('Select the schemes you want to allow for direct upload.'),
      '#states' => array(
        'visible' => array(
          ':input[name="direct"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
  }
  return $form;
}