final class MenuItemsLinkProvider in JSON:API Menu Items 1.1.x
Same name and namespace in other branches
- 1.2.x src/Plugin/jsonapi_hypermedia/LinkProvider/MenuItemsLinkProvider.php \Drupal\jsonapi_menu_items\Plugin\jsonapi_hypermedia\LinkProvider\MenuItemsLinkProvider
Provides a JSON:API Menu Items LinkProvider.
Plugin annotation
@JsonapiHypermediaLinkProvider(
id = "jsonapi_menu_items.top_level.menu_items",
deriver = "Drupal\jsonapi_menu_items\Plugin\Derivative\MenuItemsLinkProviderDeriver",
link_relation_type = "menu_items",
)
Hierarchy
- class \Drupal\jsonapi_menu_items\Plugin\jsonapi_hypermedia\LinkProvider\MenuItemsLinkProvider extends \Drupal\jsonapi_hypermedia\Plugin\LinkProviderBase implements ContainerFactoryPluginInterface
Expanded class hierarchy of MenuItemsLinkProvider
File
- src/
Plugin/ jsonapi_hypermedia/ LinkProvider/ MenuItemsLinkProvider.php, line 23
Namespace
Drupal\jsonapi_menu_items\Plugin\jsonapi_hypermedia\LinkProviderView source
final class MenuItemsLinkProvider extends LinkProviderBase implements ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
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());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuItemsLinkProvider:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
MenuItemsLinkProvider:: |
public | function |