protected function ImporterForm::getEntityTypeImporterOptions in CSV Importer 8
Get entity importer plugin options.
Parameters
string $entity_type: Entity type.
Return value
array Entity importer plugin options.
1 call to ImporterForm::getEntityTypeImporterOptions()
- ImporterForm::buildForm in src/
Form/ ImporterForm.php - Form constructor.
File
- src/
Form/ ImporterForm.php, line 259
Class
- ImporterForm
- Provides CSV importer form.
Namespace
Drupal\csv_importer\FormCode
protected function getEntityTypeImporterOptions(string $entity_type) {
$plugin_definitions = $this->importer
->getDefinitions();
$entity_type_importers = array_keys(array_combine(array_keys($plugin_definitions), array_column($plugin_definitions, 'entity_type')), $entity_type);
if ($entity_type_importers && is_array($entity_type_importers)) {
$plugin_definitions = array_intersect_key($plugin_definitions, array_flip($entity_type_importers));
foreach ($plugin_definitions as $plugin_id => $plugin_defintion) {
$options[$plugin_id] = $plugin_defintion['label'];
}
}
return $options;
}