public function ResourceManager::negotiate in RESTful 7.2
Gets the resource plugin based on the information in the request object.
Return value
ResourceInterface The resource plugin instance.
Throws
ServerConfigurationException If the plugin could not be found.
Overrides ResourceManagerInterface::negotiate
File
- src/
Resource/ ResourceManager.php, line 163 - Contains \Drupal\restful\Resource\ResourceManager.
Class
Namespace
Drupal\restful\ResourceCode
public function negotiate() {
$version = $this
->getVersionFromRequest();
list($resource_name, ) = static::getPageArguments($this->request
->getPath(FALSE));
try {
$resource = $this
->getPlugin($resource_name . PluginBase::DERIVATIVE_SEPARATOR . $version[0] . '.' . $version[1]);
return $resource
->isEnabled() ? $resource : NULL;
} catch (PluginNotFoundException $e) {
throw new ServerConfigurationException($e
->getMessage());
}
}