You are here

protected function RestInspectionTrait::getEntityType in OpenAPI 8

Gets the entity type if any for REST resource.

Parameters

\Drupal\rest\RestResourceConfigInterface $resource_config: The REST config resource.

Return value

\Drupal\Core\Entity\EntityTypeInterface|null The Entity Type or null.

3 calls to RestInspectionTrait::getEntityType()
RestGenerator::getPaths in src/Plugin/openapi/OpenApiGenerator/RestGenerator.php
Returns the paths information.
RestGenerator::nonBundleResourcesJson in src/Plugin/openapi/OpenApiGenerator/RestGenerator.php
Return resources for non-entity resources.
RestInspectionTrait::getRestEnabledEntityTypes in src/RestInspectionTrait.php
Gets entity types that are enabled for rest.

File

src/RestInspectionTrait.php, line 87

Class

RestInspectionTrait
Common functions for inspecting REST resources.

Namespace

Drupal\openapi

Code

protected function getEntityType(RestResourceConfigInterface $resource_config) {
  if ($this
    ->isEntityResource($resource_config)) {
    $resource_plugin = $resource_config
      ->getResourcePlugin();
    return $this->entityTypeManager
      ->getDefinition($resource_plugin
      ->getPluginDefinition()['entity_type']);
  }
  return NULL;
}