protected function ImporterForm::getEntityTypeFields in CSV Importer 8
Get entity type fields.
Parameters
string $entity_type: Entity type.
string|null $entity_type_bundle: Entity type bundle.
Return value
array Entity type fields.
1 call to ImporterForm::getEntityTypeFields()
- ImporterForm::submitForm in src/
Form/ ImporterForm.php - Form submission handler.
File
- src/
Form/ ImporterForm.php, line 285
Class
- ImporterForm
- Provides CSV importer form.
Namespace
Drupal\csv_importer\FormCode
protected function getEntityTypeFields(string $entity_type, string $entity_type_bundle = NULL) {
$fields = [];
if (!$entity_type_bundle) {
$entity_type_bundle = key($this->entityBundleInfo
->getBundleInfo($entity_type));
}
$entity_fields = $this->entityFieldManager
->getFieldDefinitions($entity_type, $entity_type_bundle);
foreach ($entity_fields as $entity_field) {
$fields['fields'][] = $entity_field
->getName();
if ($entity_field
->isRequired()) {
$fields['required'][] = $entity_field
->getName();
}
}
return $fields;
}