function certificate_get_entity_types in Certificate 4.x
Returns a list of all entity types with an entity reference field targeting certificate_mapping entities
3 calls to certificate_get_entity_types()
- CertificateEntityForm::buildForm in src/
Form/ CertificateEntityForm.php - Form constructor.
- CertificateLocalTasks::getDerivativeDefinitions in src/
Plugin/ Derivative/ CertificateLocalTasks.php - Gets the definition of all derivatives of a base plugin.
- CertificateRoutes::routes in src/
Routing/ CertificateRoutes.php
File
- ./
certificate.module, line 199
Code
function certificate_get_entity_types() {
$entity_types = [];
/* @var $fields Drupal\field\Entity\FieldConfig[] */
$fields = \Drupal::entityTypeManager()
->getStorage('field_config')
->loadByProperties([
'field_type' => 'entity_reference',
]);
foreach ($fields as $field) {
if ($field
->getSetting('target_type') == 'certificate_mapping') {
$entity_types[] = $field
->getTargetEntityTypeId();
}
}
return $entity_types;
}