BaseFieldDefinition::getCardinality

public BaseFieldDefinition::getCardinality() Returns the maximum number of items allowed for the field. Possible values are positive integers or FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED. Return value int The field cardinality. Overrides FieldStorageDefinitionInterface::getCardinality File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 257 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public function getCardinalit

BaseFieldDefinition::getConfig

public BaseFieldDefinition::getConfig($bundle) Gets an object that can be saved in configuration. Base fields are defined in code. In order to configure field definition properties per bundle use this method to create an override that can be saved in configuration. Parameters string $bundle: The bundle to get the configurable field for. Return value \Drupal\Core\Field\FieldConfigInterface Overrides FieldDefinitionInterface::getConfig See also \Drupal\Core\Field\Entity\BaseFieldBundleOverride

BaseFieldDefinition::getDefaultValue

public BaseFieldDefinition::getDefaultValue(FieldableEntityInterface $entity) Returns the default value for the field in a newly created entity. This method computes the runtime default value for a field in a given entity. To access the raw properties assigned to the field definition, ::getDefaultValueLiteral() or ::getDefaultValueCallback() should be used instead. Parameters \Drupal\Core\Entity\FieldableEntityInterface $entity: The entity for which the default value is generated. Return value

BaseFieldDefinition::createFromItemType

public static BaseFieldDefinition::createFromItemType($item_type) Creates a new list data definition for items of the given data type. This method is typically used by \Drupal\Core\TypedData\TypedDataManager::createListDataDefinition() to build a definition object for an arbitrary item type. When the definition class is known, it is recommended to directly use the static create() method on that class instead; e.g.: $list_definition = \Drupal\Core\TypedData\ListDataDefinition::create('string')

BaseFieldDefinition::getColumns

public BaseFieldDefinition::getColumns() Returns the field columns, as defined in the field schema. Return value array[] The array of field columns, keyed by column name, in the same format returned by getSchema(). Overrides FieldStorageDefinitionInterface::getColumns See also \Drupal\Core\Field\FieldStorageDefinitionInterface::getSchema() File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 656 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Co

BaseFieldDefinition::$propertyDefinitions

An array of field property definitions. Type: \Drupal\Core\TypedData\DataDefinitionInterface[] See also \Drupal\Core\TypedData\ComplexDataDefinitionInterface::getPropertyDefinitions() File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 33 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code protected $propertyDefinitions;

BaseFieldDefinition::addPropertyConstraints

public BaseFieldDefinition::addPropertyConstraints($name, array $constraints) Adds constraints for a given field item property. Adds a constraint to a property of a base field item. e.g. // Limit the field item's value property to the range 0 through 10. // e.g. $node->size->value. $field->addPropertyConstraints('value', [ 'Range' => [ 'min' => 0, 'max' => 10, ] ]); If you want to add a validation constraint that applies to the \Drupal\Core\Field\FieldItemList, u

BaseFieldDefinition::create

public static BaseFieldDefinition::create($type) Creates a new field definition. Parameters string $type: The type of the field. Return value static A new field definition object. Overrides ListDataDefinition::create File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 56 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code public static function create($type) { $field_definition = new static(array()); $field_definition->type

BaseFieldDefinition::createFromFieldStorageDefinition

public static BaseFieldDefinition::createFromFieldStorageDefinition(FieldStorageDefinitionInterface $definition) Creates a new field definition based upon a field storage definition. In cases where one needs a field storage definitions to act like full field definitions, this creates a new field definition based upon the (limited) information available. That way it is possible to use the field definition in places where a full field definition is required; e.g., with widgets or formatters. Para

BaseFieldDefinition::$type

The field type. Type: string File core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 24 Class BaseFieldDefinition A class for defining entity fields. Namespace Drupal\Core\Field Code protected $type;