class OpenerResolver in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media_library/src/OpenerResolver.php \Drupal\media_library\OpenerResolver
- 10 core/modules/media_library/src/OpenerResolver.php \Drupal\media_library\OpenerResolver
Defines a class to get media library openers from the container.
This is intended to be a very thin interface-verifying wrapper around services which implement \Drupal\media_library\MediaLibraryOpenerInterface. It is not an API and should not be extended or used by code that does not interact with the Media Library module.
@internal This service is an internal part of the modal media library dialog and does not provide any extension points or public API.
Hierarchy
- class \Drupal\media_library\OpenerResolver implements OpenerResolverInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
Expanded class hierarchy of OpenerResolver
1 string reference to 'OpenerResolver'
- media_library.services.yml in core/
modules/ media_library/ media_library.services.yml - core/modules/media_library/media_library.services.yml
1 service uses OpenerResolver
- media_library.opener_resolver in core/
modules/ media_library/ media_library.services.yml - Drupal\media_library\OpenerResolver
File
- core/
modules/ media_library/ src/ OpenerResolver.php, line 19
Namespace
Drupal\media_libraryView source
class OpenerResolver implements OpenerResolverInterface {
use ContainerAwareTrait;
/**
* {@inheritdoc}
*/
public function get(MediaLibraryState $state) {
$service_id = $state
->getOpenerId();
$service = $this->container
->get($service_id);
if ($service instanceof MediaLibraryOpenerInterface) {
return $service;
}
throw new \RuntimeException("{$service_id} must be an instance of " . MediaLibraryOpenerInterface::class);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenerResolver:: |
public | function |
Gets a media library opener service from the container. Overrides OpenerResolverInterface:: |