You are here

class BundleFieldDefinition in Entity API 8

Provides a field definition class for bundle fields.

Core currently doesn't provide one, the hook_entity_bundle_field_info() example uses BaseFieldDefinition, which is wrong. Tracked in #2346347.

Note that this class implements both FieldStorageDefinitionInterface and FieldDefinitionInterface. This is a simplification for DX reasons, allowing code to return just the bundle definitions instead of having to return both storage definitions and bundle definitions.

Hierarchy

Expanded class hierarchy of BundleFieldDefinition

2 files declare their use of BundleFieldDefinition
First.php in tests/modules/entity_module_bundle_plugin_test/src/Plugin/BundlePluginTest/First.php
Second.php in tests/modules/entity_module_bundle_plugin_examples_test/src/Plugin/BundlePluginTest/Second.php

File

src/BundleFieldDefinition.php, line 18

Namespace

Drupal\entity
View source
class BundleFieldDefinition extends BaseFieldDefinition {

  /**
   * {@inheritdoc}
   */
  public function isBaseField() {
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseFieldDefinition::$indexes protected property
BaseFieldDefinition::$propertyDefinitions protected property An array of field property definitions.
BaseFieldDefinition::$schema protected property The field schema.
BaseFieldDefinition::$type protected property The field type.
BaseFieldDefinition::addPropertyConstraints public function Adds constraints for a given field item property.
BaseFieldDefinition::create public static function Creates a new field definition. Overrides ListDataDefinition::create 1
BaseFieldDefinition::createFromFieldStorageDefinition public static function Creates a new field definition based upon a field storage definition.
BaseFieldDefinition::createFromItemType public static function Creates a new list data definition for items of the given data type. Overrides ListDataDefinition::createFromItemType
BaseFieldDefinition::getCardinality public function Returns the maximum number of items allowed for the field. Overrides FieldStorageDefinitionInterface::getCardinality
BaseFieldDefinition::getColumns public function Returns the field columns, as defined in the field schema. Overrides FieldStorageDefinitionInterface::getColumns
BaseFieldDefinition::getConfig public function Gets an object that can be saved in configuration. Overrides FieldDefinitionInterface::getConfig
BaseFieldDefinition::getDefaultValue public function Returns the default value for the field in a newly created entity. Overrides FieldDefinitionInterface::getDefaultValue
BaseFieldDefinition::getDefaultValueCallback public function Returns the default value callback for the field. Overrides FieldDefinitionInterface::getDefaultValueCallback
BaseFieldDefinition::getDefaultValueLiteral public function Returns the default value literal for the field. Overrides FieldDefinitionInterface::getDefaultValueLiteral
BaseFieldDefinition::getDisplayOptions public function Returns the default display options for the field. Overrides FieldDefinitionInterface::getDisplayOptions
BaseFieldDefinition::getFieldItemClass Deprecated protected function Helper to retrieve the field item class.
BaseFieldDefinition::getFieldStorageDefinition public function Returns the field storage definition. Overrides FieldDefinitionInterface::getFieldStorageDefinition
BaseFieldDefinition::getInitialValue public function Returns the initial value for the field.
BaseFieldDefinition::getInitialValueFromField public function Returns the name of the field that will be used for getting initial values.
BaseFieldDefinition::getMainPropertyName public function Returns the name of the main property, if any. Overrides FieldStorageDefinitionInterface::getMainPropertyName
BaseFieldDefinition::getName public function Returns the machine name of the field. Overrides FieldDefinitionInterface::getName
BaseFieldDefinition::getOptionsProvider public function Gets an options provider for the given field item property. Overrides FieldStorageDefinitionInterface::getOptionsProvider
BaseFieldDefinition::getPropertyDefinition public function Gets the definition of a contained property. Overrides FieldStorageDefinitionInterface::getPropertyDefinition
BaseFieldDefinition::getPropertyDefinitions public function Gets an array of property definitions of contained properties. Overrides FieldStorageDefinitionInterface::getPropertyDefinitions
BaseFieldDefinition::getPropertyNames public function Returns the names of the field's subproperties. Overrides FieldStorageDefinitionInterface::getPropertyNames
BaseFieldDefinition::getProvider public function Returns the name of the provider of this field. Overrides FieldStorageDefinitionInterface::getProvider
BaseFieldDefinition::getSchema public function Returns the field schema. Overrides FieldStorageDefinitionInterface::getSchema
BaseFieldDefinition::getSetting public function Returns the value of a given setting. Overrides DataDefinition::getSetting
BaseFieldDefinition::getSettings public function Returns the array of settings, as required by the used class. Overrides DataDefinition::getSettings 1
BaseFieldDefinition::getTargetBundle public function Gets the bundle the field is attached to. Overrides FieldDefinitionInterface::getTargetBundle
BaseFieldDefinition::getTargetEntityTypeId public function Returns the ID of the entity type the field is attached to. Overrides FieldDefinitionInterface::getTargetEntityTypeId
BaseFieldDefinition::getType public function Returns the field type. Overrides FieldDefinitionInterface::getType 1
BaseFieldDefinition::getUniqueIdentifier public function Returns a unique identifier for the field. Overrides FieldDefinitionInterface::getUniqueIdentifier
BaseFieldDefinition::getUniqueStorageIdentifier public function Returns a unique identifier for the field storage. Overrides FieldStorageDefinitionInterface::getUniqueStorageIdentifier
BaseFieldDefinition::hasCustomStorage public function Returns the storage behavior for this field. Overrides FieldStorageDefinitionInterface::hasCustomStorage
BaseFieldDefinition::isDeleted public function Returns whether the field is deleted or not. Overrides FieldStorageDefinitionInterface::isDeleted
BaseFieldDefinition::isDisplayConfigurable public function Returns whether the display for the field can be configured. Overrides FieldDefinitionInterface::isDisplayConfigurable
BaseFieldDefinition::isInternal public function Determines whether the data value is internal. Overrides DataDefinition::isInternal
BaseFieldDefinition::isMultiple public function Returns whether the field can contain multiple items. Overrides FieldStorageDefinitionInterface::isMultiple
BaseFieldDefinition::isQueryable public function Determines whether the field is queryable via QueryInterface. Overrides FieldStorageDefinitionInterface::isQueryable
BaseFieldDefinition::isRevisionable public function Returns whether the field storage is revisionable. Overrides FieldStorageDefinitionInterface::isRevisionable
BaseFieldDefinition::isStorageRequired public function Returns whether the field storage is required. Overrides RequiredFieldStorageDefinitionInterface::isStorageRequired
BaseFieldDefinition::isTranslatable public function Returns whether the field is translatable. Overrides FieldDefinitionInterface::isTranslatable
BaseFieldDefinition::setCardinality public function Sets the maximum number of items allowed for the field.
BaseFieldDefinition::setCustomStorage public function Sets the storage behavior for this field.
BaseFieldDefinition::setDefaultValue public function
BaseFieldDefinition::setDefaultValueCallback public function
BaseFieldDefinition::setDeleted public function Sets whether the field storage is deleted.
BaseFieldDefinition::setDisplayConfigurable public function Sets whether the display for the field can be configured.
BaseFieldDefinition::setDisplayOptions public function Sets the display options for the field in forms or rendered entities.
BaseFieldDefinition::setInitialValue public function Sets an initial value for the field.
BaseFieldDefinition::setInitialValueFromField public function Sets a field that will be used for getting initial values.
BaseFieldDefinition::setName public function Sets the field name.
BaseFieldDefinition::setPropertyConstraints public function Sets constraints for a given field item property.
BaseFieldDefinition::setProvider public function Sets the name of the provider of this field.
BaseFieldDefinition::setQueryable Deprecated public function Sets whether the field is queryable.
BaseFieldDefinition::setRevisionable public function Sets whether the field is revisionable.
BaseFieldDefinition::setSetting public function Sets a definition setting. Overrides DataDefinition::setSetting
BaseFieldDefinition::setSettings public function Note that the method does not unset existing settings not specified in the incoming $settings array. Overrides DataDefinition::setSettings
BaseFieldDefinition::setStorageRequired public function Sets whether the field storage is required.
BaseFieldDefinition::setTargetBundle public function Sets the bundle this field is defined for.
BaseFieldDefinition::setTargetEntityTypeId public function Sets the ID of the type of the entity this field is attached to.
BaseFieldDefinition::setTranslatable public function Sets whether the field is translatable. Overrides FieldStorageDefinitionInterface::setTranslatable
BaseFieldDefinition::__clone public function Magic method: Implements a deep clone. Overrides ListDataDefinition::__clone
BaseFieldDefinition::__sleep public function Overrides DataDefinition::__sleep
BundleFieldDefinition::isBaseField public function Determines whether the field is a base field. Overrides BaseFieldDefinition::isBaseField
DataDefinition::$definition protected property The array holding values for all definition keys.
DataDefinition::addConstraint public function Adds a validation constraint. Overrides DataDefinitionInterface::addConstraint
DataDefinition::getConstraint public function Returns a validation constraint. Overrides DataDefinitionInterface::getConstraint
DataDefinition::getConstraints public function Returns an array of validation constraints. Overrides DataDefinitionInterface::getConstraints 1
DataDefinition::getDescription public function Returns a human readable description. Overrides DataDefinitionInterface::getDescription
DataDefinition::getLabel public function Returns a human readable label. Overrides DataDefinitionInterface::getLabel
DataDefinition::isComputed public function Determines whether the data value is computed. Overrides DataDefinitionInterface::isComputed
DataDefinition::isList public function Returns whether the data is multi-valued, i.e. a list of data items. Overrides DataDefinitionInterface::isList
DataDefinition::isReadOnly public function Determines whether the data is read-only. Overrides DataDefinitionInterface::isReadOnly
DataDefinition::isRequired public function Determines whether a data value is required. Overrides DataDefinitionInterface::isRequired
DataDefinition::offsetExists public function This is for BC support only. @todo: Remove in https://www.drupal.org/node/1928868.
DataDefinition::offsetGet public function This is for BC support only. @todo: Remove in https://www.drupal.org/node/1928868.
DataDefinition::offsetSet public function This is for BC support only. @todo: Remove in https://www.drupal.org/node/1928868.
DataDefinition::offsetUnset public function This is for BC support only. @todo: Remove in https://www.drupal.org/node/1928868.
DataDefinition::setClass public function Sets the class used for creating the typed data object.
DataDefinition::setComputed public function Sets whether the data is computed.
DataDefinition::setConstraints public function Sets an array of validation constraints.
DataDefinition::setDescription public function Sets the human-readable description.
DataDefinition::setInternal public function Sets the whether the data value should be internal.
DataDefinition::setLabel public function Sets the human-readable label.
DataDefinition::setReadOnly public function Sets whether the data is read-only.
DataDefinition::setRequired public function Sets whether the data is required.
DataDefinition::toArray public function Returns all definition values as array.
FieldInputValueNormalizerTrait::normalizeValue protected static function Ensure a field value is transformed into a format keyed by delta.
FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED constant Value indicating a field accepts an unlimited number of values.
ListDataDefinition::$itemDefinition protected property The data definition of a list item.
ListDataDefinition::createFromDataType public static function Creates a new data definition object. Overrides DataDefinition::createFromDataType
ListDataDefinition::getClass public function Returns the class used for creating the typed data object. Overrides DataDefinition::getClass
ListDataDefinition::getDataType public function Returns the data type of the data. Overrides DataDefinition::getDataType
ListDataDefinition::getItemDefinition public function Gets the data definition of an item of the list. Overrides ListDataDefinitionInterface::getItemDefinition
ListDataDefinition::setDataType public function Sets the data type. Overrides DataDefinition::setDataType
ListDataDefinition::setItemDefinition public function Sets the item definition.
ListDataDefinition::__construct public function Constructs a new data definition object. Overrides DataDefinition::__construct
TypedDataTrait::$typedDataManager protected property The typed data manager used for creating the data types.
TypedDataTrait::getTypedDataManager public function Gets the typed data manager. 2
TypedDataTrait::setTypedDataManager public function Sets the typed data manager. 2
UnchangingCacheableDependencyTrait::getCacheContexts public function 1
UnchangingCacheableDependencyTrait::getCacheMaxAge public function 3
UnchangingCacheableDependencyTrait::getCacheTags public function 1