function RestResourceConfig::getFormatsForMethodGranularity
Same name in other branches
- 8.9.x core/modules/rest/src/Entity/RestResourceConfig.php \Drupal\rest\Entity\RestResourceConfig::getFormatsForMethodGranularity()
- 10 core/modules/rest/src/Entity/RestResourceConfig.php \Drupal\rest\Entity\RestResourceConfig::getFormatsForMethodGranularity()
- 11.x core/modules/rest/src/Entity/RestResourceConfig.php \Drupal\rest\Entity\RestResourceConfig::getFormatsForMethodGranularity()
Retrieves a list of supported response formats.
Parameters
string $method: The request method e.g GET or POST.
Return value
string[] A list of supported format IDs.
1 call to RestResourceConfig::getFormatsForMethodGranularity()
- RestResourceConfig::getFormats in core/
modules/ rest/ src/ Entity/ RestResourceConfig.php - Retrieves a list of supported response formats.
File
-
core/
modules/ rest/ src/ Entity/ RestResourceConfig.php, line 194
Class
- RestResourceConfig
- Defines a RestResourceConfig configuration entity class.
Namespace
Drupal\rest\EntityCode
protected function getFormatsForMethodGranularity($method) {
$method = $this->normalizeRestMethod($method);
if (in_array($method, $this->getMethods()) && isset($this->configuration[$method]['supported_formats'])) {
return $this->configuration[$method]['supported_formats'];
}
return [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.