March 2019
Intermediate to advanced
580 pages
15h 3m
English
The other obligatory method we need to implement is getConfigurationForm(), by which we define the form elements needed to configure this particular plugin. Here, we will create the file field allowing users to upload the CSV file:
/**
* {@inheritdoc}
*/
public function getConfigurationForm(\Drupal\products\Entity\ImporterInterface $importer) {
$form = [];
$config = $importer->getPluginConfiguration();
$form['file'] = [
'#type' => 'managed_file',
'#default_value' => isset($config['file']) ? $config['file'] : '',
'#title' => $this->t('File'),
'#description' => $this->t('The CSV file containing the product records.'),
'#required' => TRUE,
];
return $form;
}
The form element type is called managed_file (implemented ...
Read now
Unlock full access