You are here

public function MenuItemsLinkProvider::getLink in JSON:API Menu Items 1.2.x

Same name and namespace in other branches
  1. 1.1.x src/Plugin/jsonapi_hypermedia/LinkProvider/MenuItemsLinkProvider.php \Drupal\jsonapi_menu_items\Plugin\jsonapi_hypermedia\LinkProvider\MenuItemsLinkProvider::getLink()

File

src/Plugin/jsonapi_hypermedia/LinkProvider/MenuItemsLinkProvider.php, line 35

Class

MenuItemsLinkProvider
Provides a JSON:API Menu Items LinkProvider.

Namespace

Drupal\jsonapi_menu_items\Plugin\jsonapi_hypermedia\LinkProvider

Code

public function getLink($context) {
  assert($context instanceof JsonApiDocumentTopLevel);
  return AccessRestrictedLink::createLink(AccessResult::allowed(), new CacheableMetadata(), new Url('jsonapi_menu_items.menu', [
    'menu' => $this->pluginDefinition['link_context']['menu_name'],
  ]), $this
    ->getLinkRelationType());
}