CsvParserFeedForm.php in Feeds 8.3
File
src/Feeds/Parser/Form/CsvParserFeedForm.php
View source
<?php
namespace Drupal\feeds\Feeds\Parser\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\feeds\FeedInterface;
use Drupal\feeds\Plugin\Type\ExternalPluginFormBase;
class CsvParserFeedForm extends ExternalPluginFormBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state, FeedInterface $feed = NULL) {
$feed_config = $feed
->getConfigurationFor($this->plugin);
$form['delimiter'] = [
'#type' => 'select',
'#title' => $this
->t('Delimiter'),
'#description' => $this
->t('The character that delimits fields in the CSV file.'),
'#options' => [
',' => ',',
';' => ';',
'TAB' => 'TAB',
'|' => '|',
'+' => '+',
],
'#default_value' => $feed_config['delimiter'],
];
$form['no_headers'] = [
'#type' => 'checkbox',
'#title' => $this
->t('No Headers'),
'#description' => $this
->t("Check if the imported CSV file does not start with a header row. If checked, mapping sources must be named '0', '1', '2' etc."),
'#default_value' => $feed_config['no_headers'],
];
return $form;
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state, FeedInterface $feed = NULL) {
$feed
->setConfigurationFor($this->plugin, $form_state
->getValues());
}
}