protected function RestInspectionTrait::getRestEnabledEntityTypes in OpenAPI 8
Gets entity types that are enabled for rest.
Parameters
string $entity_type_id: The entity type id.
Return value
\Drupal\Core\Entity\EntityTypeInterface[] Entity types that are enabled.
2 calls to RestInspectionTrait::getRestEnabledEntityTypes()
- RestGenerator::getDefinitions in src/
Plugin/ openapi/ OpenApiGenerator/ RestGenerator.php - Get model definitions for Drupal entities and bundles.
- RestGenerator::getTags in src/
Plugin/ openapi/ OpenApiGenerator/ RestGenerator.php - Get tags.
File
- src/
RestInspectionTrait.php, line 22
Class
- RestInspectionTrait
- Common functions for inspecting REST resources.
Namespace
Drupal\openapiCode
protected function getRestEnabledEntityTypes($entity_type_id = NULL) {
$entity_types = [];
$resource_configs = $this
->getResourceConfigs();
foreach ($resource_configs as $resource_config) {
if ($entity_type = $this
->getEntityType($resource_config)) {
if (!$entity_type_id || $entity_type
->id() == $entity_type_id) {
$entity_types[$entity_type
->id()] = $entity_type;
}
}
}
return $entity_types;
}