protected function Formatter::isCacheEnabled in RESTful 7.2
Checks if the passed in data to be rendered can be cached.
Parameters
mixed $data: The data to be prepared and rendered.
Return value
bool TRUE if the data can be cached.
3 calls to Formatter::isCacheEnabled()
- FormatterHalJson::extractFieldValues in src/
Plugin/ formatter/ FormatterHalJson.php - Extracts the actual values from the resource fields.
- FormatterJson::extractFieldValues in src/
Plugin/ formatter/ FormatterJson.php - Extracts the actual values from the resource fields.
- FormatterJsonApi::extractFieldValues in src/
Plugin/ formatter/ FormatterJsonApi.php - Extracts the actual values from the resource fields.
File
- src/
Plugin/ formatter/ Formatter.php, line 114 - Contains \Drupal\restful\Plugin\formatter\Formatter
Class
- Formatter
- Class Formatter.
Namespace
Drupal\restful\Plugin\formatterCode
protected function isCacheEnabled($data) {
// We are only caching field collections, but you could cache at different
// layers too.
if (!$data instanceof ResourceFieldCollectionInterface) {
return FALSE;
}
if (!($context = $data
->getContext())) {
return FALSE;
}
return !empty($context['cache_fragments']);
}