You are here

public function MenuItemsResource::getRouteResourceTypes in JSON:API Menu Items 1.0.x

Same name and namespace in other branches
  1. 1.2.x src/Resource/MenuItemsResource.php \Drupal\jsonapi_menu_items\Resource\MenuItemsResource::getRouteResourceTypes()
  2. 1.1.x src/Resource/MenuItemsResource.php \Drupal\jsonapi_menu_items\Resource\MenuItemsResource::getRouteResourceTypes()

File

src/Resource/MenuItemsResource.php, line 82

Class

MenuItemsResource
Processes a request for a collection of featured nodes.

Namespace

Drupal\jsonapi_menu_items\Resource

Code

public function getRouteResourceTypes(Route $route, string $route_name) : array {
  $resource_types = [];
  foreach ([
    'menu_link_config',
    'menu_link_content',
  ] as $type) {
    $resource_type = $this->resourceTypeRepository
      ->get($type, $type);
    if ($resource_type) {
      $resource_types[] = $resource_type;
    }
  }
  return $resource_types;
}