You are here

public function FeedsProcessor::configForm in Feeds 8.2

Overrides parent::configForm().

Overrides FeedsConfigurable::configForm

2 calls to FeedsProcessor::configForm()
FeedsNodeProcessor::configForm in lib/Drupal/feeds/Plugin/feeds/processor/FeedsNodeProcessor.php
Override parent::configForm().
FeedsUserProcessor::configForm in lib/Drupal/feeds/Plugin/feeds/processor/FeedsUserProcessor.php
Override parent::configForm().
2 methods override FeedsProcessor::configForm()
FeedsNodeProcessor::configForm in lib/Drupal/feeds/Plugin/feeds/processor/FeedsNodeProcessor.php
Override parent::configForm().
FeedsUserProcessor::configForm in lib/Drupal/feeds/Plugin/feeds/processor/FeedsUserProcessor.php
Override parent::configForm().

File

lib/Drupal/feeds/Plugin/FeedsProcessor.php, line 614
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Namespace

Drupal\feeds\Plugin

Code

public function configForm(&$form_state) {
  $info = $this
    ->entityInfo();
  $form = array();
  if (!empty($info['entity_keys']['bundle'])) {
    $form['bundle'] = array(
      '#type' => 'select',
      '#options' => $this
        ->bundleOptions(),
      '#title' => !empty($info['bundle_label']) ? $info['bundle_label'] : t('Bundle'),
      '#required' => TRUE,
      '#default_value' => $this
        ->bundle(),
    );
  }
  else {
    $form['bundle'] = array(
      '#type' => 'value',
      '#value' => $this
        ->entityType(),
    );
  }
  $tokens = array(
    '@entities' => strtolower($info['label plural']),
  );
  $form['update_existing'] = array(
    '#type' => 'radios',
    '#title' => t('Update existing @entities', $tokens),
    '#description' => t('Existing @entities will be determined using mappings that are a "unique target".', $tokens),
    '#options' => array(
      FEEDS_SKIP_EXISTING => t('Do not update existing @entities', $tokens),
      FEEDS_REPLACE_EXISTING => t('Replace existing @entities', $tokens),
      FEEDS_UPDATE_EXISTING => t('Update existing @entities', $tokens),
    ),
    '#default_value' => $this->config['update_existing'],
  );
  global $user;
  $formats = filter_formats($user);
  foreach ($formats as $format) {
    $format_options[$format->format] = $format->name;
  }
  $form['skip_hash_check'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip hash check'),
    '#description' => t('Force update of items even if item source data did not change.'),
    '#default_value' => $this->config['skip_hash_check'],
  );
  $form['input_format'] = array(
    '#type' => 'select',
    '#title' => t('Text format'),
    '#description' => t('Select the input format for the body field of the nodes to be created.'),
    '#options' => $format_options,
    '#default_value' => isset($this->config['input_format']) ? $this->config['input_format'] : 'plain_text',
    '#required' => TRUE,
  );
  return $form;
}