You are here

protected function RestInspectionTrait::getResourceConfigs in OpenAPI 8

Gets the REST config resources.

Parameters

array $options: The options to generate the output.

Return value

\Drupal\rest\RestResourceConfigInterface[] The REST config resources.

3 calls to RestInspectionTrait::getResourceConfigs()
RestGenerator::getPaths in src/Plugin/openapi/OpenApiGenerator/RestGenerator.php
Returns the paths information.
RestGenerator::getRestSupportedFormats in src/Plugin/openapi/OpenApiGenerator/RestGenerator.php
Returns a list of supported Format on REST.
RestInspectionTrait::getRestEnabledEntityTypes in src/RestInspectionTrait.php
Gets entity types that are enabled for rest.

File

src/RestInspectionTrait.php, line 45

Class

RestInspectionTrait
Common functions for inspecting REST resources.

Namespace

Drupal\openapi

Code

protected function getResourceConfigs(array $options = []) {
  if (isset($options['entity_type_id'])) {
    $resource_configs[] = $this->entityTypeManager
      ->getStorage('rest_resource_config')
      ->load("entity.{$options['entity_type_id']}");
  }
  else {
    $resource_configs = $this->entityTypeManager
      ->getStorage('rest_resource_config')
      ->loadMultiple();
    if (isset($options['resource_types']) && $options['resource_types'] == 'entities') {
      foreach (array_keys($resource_configs) as $resource_key) {
        if (!$this
          ->isEntityResource($resource_configs[$resource_key])) {
          unset($resource_configs[$resource_key]);
        }
      }
    }
  }
  return $resource_configs;
}