protected function FieldBlockConfigForm::getOrphanedEntityTypes in Field as Block 8.2
Get orphaned entity types.
Get all entity types that have Field Blocks but are either: 1. No longer set to be used with this module 2. Don't exist on the site.
@todo param and return doc blocks must specify array of what, eg. string[].
Parameters
array $enabled_entity_types: Currently enabled entity types.
Return value
array Entity type ids.
1 call to FieldBlockConfigForm::getOrphanedEntityTypes()
- FieldBlockConfigForm::buildForm in src/
Form/ FieldBlockConfigForm.php - Form constructor.
File
- src/
Form/ FieldBlockConfigForm.php, line 235
Class
- FieldBlockConfigForm
- Configuration for select Entity types and delete blocks of unused types.
Namespace
Drupal\fieldblock\FormCode
protected function getOrphanedEntityTypes(array $enabled_entity_types) {
$orphaned_types = [];
$entity_types_used = $this->storage
->getEntityTypesUsed();
$all_entity_types = $this
->getAllEntityTypes();
foreach ($entity_types_used as $used_type) {
if (!in_array($used_type, $all_entity_types) || !in_array($used_type, $enabled_entity_types)) {
$orphaned_types[] = $used_type;
}
}
return $orphaned_types;
}