public function Formatter::getResource in RESTful 7.2
Gets the underlying resource.
Return value
ResourceInterface The resource.
Overrides FormatterInterface::getResource
11 calls to Formatter::getResource()
- Formatter::createCacheController in src/
Plugin/ formatter/ Formatter.php - Gets a cache controller based on the data to be rendered.
- Formatter::limitFields in src/
Plugin/ formatter/ Formatter.php - Returns only the allowed fields by filtering out the other ones.
- FormatterHalJson::addHateoas in src/
Plugin/ formatter/ FormatterHalJson.php - Add HATEOAS links to list of item.
- FormatterHalJson::prepare in src/
Plugin/ formatter/ FormatterHalJson.php - Massages the raw data to create a structured array to pass to the renderer.
- FormatterJson::addHateoas in src/
Plugin/ formatter/ FormatterJson.php - Add HATEOAS links to list of item.
File
- src/
Plugin/ formatter/ Formatter.php, line 61 - Contains \Drupal\restful\Plugin\formatter\Formatter
Class
- Formatter
- Class Formatter.
Namespace
Drupal\restful\Plugin\formatterCode
public function getResource() {
if (isset($this->resource)) {
return $this->resource;
}
// Get the resource from the instance configuration.
$instance_configuration = $this
->getConfiguration();
if (empty($instance_configuration['resource'])) {
return NULL;
}
$this->resource = $instance_configuration['resource'] instanceof ResourceInterface ? $instance_configuration['resource'] : NULL;
return $this->resource;
}