You are here

public function BaseFieldDefinition::setCardinality in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::setCardinality()

Sets the maximum number of items allowed for the field.

Possible values are positive integers or FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED.

Parameters

int $cardinality: The field cardinality.

Return value

$this

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 278
Contains \Drupal\Core\Field\BaseFieldDefinition.

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

public function setCardinality($cardinality) {
  $this->definition['cardinality'] = $cardinality;
  return $this;
}