You are here

public function ServiceResource::getFormats in Services 9.0.x

Same name and namespace in other branches
  1. 8.4 src/Entity/ServiceResource.php \Drupal\services\Entity\ServiceResource::getFormats()

Get resource allowed formats.

Return value

array An array of allowed formats.

Overrides ServiceResourceInterface::getFormats

File

src/Entity/ServiceResource.php, line 104

Class

ServiceResource
Defines service resource entity.

Namespace

Drupal\services\Entity

Code

public function getFormats() {
  if (!empty($this->formats)) {
    return array_filter($this->formats);
  }
  return $this
    ->getDefaultSettings()
    ->get('default_formats');
}