You are here

public function ResourceFieldResource::getCardinality in RESTful 7.2

Gets the cardinality of the field.

Return value

int The number of potentially returned fields. Reuses field cardinality constants.

Overrides ResourceFieldInterface::getCardinality

File

src/Plugin/resource/Field/ResourceFieldResource.php, line 115
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldResource.

Class

ResourceFieldResource

Namespace

Drupal\restful\Plugin\resource\Field

Code

public function getCardinality() {
  if ($this->decorated instanceof ResourceFieldEntityInterface) {
    return $this->decorated
      ->getCardinality();
  }

  // Default to single cardinality.
  return 1;
}