You are here

public static function TopLevelSchemaLinkProviderBase::create in JSON:API Schema 8

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides ContainerFactoryPluginInterface::create

File

src/Plugin/jsonapi_hypermedia/LinkProvider/TopLevelSchemaLinkProviderBase.php, line 37

Class

TopLevelSchemaLinkProviderBase
Class TopLevelSchemaLinkProviderBase.

Namespace

Drupal\jsonapi_schema\Plugin\jsonapi_hypermedia\LinkProvider

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  assert(in_array(static::$schemaRouteType, [
    'item',
    'collection',
    'entrypoint',
  ], TRUE));
  $provider = new static($configuration, $plugin_id, $plugin_definition);
  $provider
    ->setCurrentRouteMatch($container
    ->get('current_route_match'));
  return $provider;
}