protected function DataProviderPlug::initDataInterpreter in RESTful 7.2
Get the data interpreter.
Parameters
mixed $identifier: The ID of thing being viewed.
Return value
\Drupal\restful\Plugin\resource\DataInterpreter\DataInterpreterInterface The data interpreter.
Overrides DataProvider::initDataInterpreter
File
- src/
Plugin/ resource/ DataProvider/ DataProviderPlug.php, line 225 - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderPlug.
Class
- DataProviderPlug
- Class DataProviderPlug.
Namespace
Drupal\restful\Plugin\resource\DataProviderCode
protected function initDataInterpreter($identifier) {
$resource_manager = restful()
->getResourceManager();
try {
$plugin = $resource_manager
->getPlugin($identifier);
} catch (UnauthorizedException $e) {
return NULL;
} catch (PluginNotFoundException $e) {
throw new NotFoundException('Invalid URL path.');
}
// If the plugin is not discoverable throw an access denied exception.
$definition = $plugin
->getPluginDefinition();
if (empty($definition['discoverable'])) {
throw new InaccessibleRecordException(sprintf('The plugin %s is not discoverable.', $plugin
->getResourceName()));
}
return new DataInterpreterPlug($this
->getAccount(), new PluginWrapper($plugin));
}