public static function GetServices::getFieldInfo in Simple Node Importer 8
1 call to GetServices::getFieldInfo()
- GetServices::generateFieldSetValue in src/
Services/ GetServices.php
File
- src/
Services/ GetServices.php, line 1241
Class
Namespace
Drupal\simple_node_importer\ServicesCode
public static function getFieldInfo($entity_type, $fieldKey, $bundle) {
$field_info = FieldStorageConfig::loadByName($entity_type, $fieldKey);
$entityManager = \Drupal::service('entity_field.manager');
$field_definition = $entityManager
->getFieldDefinitions($entity_type, $bundle);
$fieldProperties = $field_definition[$fieldKey];
$fieldLabel = $field_info
->getLabel();
$fieldType = $field_info
->getType();
$fieldTypeProvider = $field_info
->getTypeProvider();
$fieldCardinality = $field_info
->getCardinality();
$fieldIsRequired = $fieldProperties
->isRequired();
$fieldInfoArray = [
'fieldLabel' => $fieldLabel,
'fieldType' => $fieldType,
'fieldTypeProvider' => $fieldTypeProvider,
'fieldCardinality' => $fieldCardinality,
'fieldIsRequired' => $fieldIsRequired,
];
return $fieldInfoArray;
}