OpenerResolver.php in Drupal 10
File
core/modules/media_library/src/OpenerResolver.php
View source
<?php
namespace Drupal\media_library;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
class OpenerResolver implements OpenerResolverInterface {
use ContainerAwareTrait;
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);
}
}
Classes
Name |
Description |
OpenerResolver |
Defines a class to get media library openers from the container. |