Drupal 8  8.0.2
FieldConfig Class Reference
Inheritance diagram for FieldConfig:

Public Member Functions

 __construct (array $values, $entity_type= 'field_config')
 
 postCreate (EntityStorageInterface $storage)
 
 preSave (EntityStorageInterface $storage)
 
 calculateDependencies ()
 
 isDeleted ()
 
 getFieldStorageDefinition ()
 
 isDisplayConfigurable ($context)
 
 getDisplayOptions ($display_context)
 
 isReadOnly ()
 
 isComputed ()
 
- Public Member Functions inherited from FieldConfigBase
 id ()
 
 getName ()
 
 getType ()
 
 getTargetEntityTypeId ()
 
 getTargetBundle ()
 
 onDependencyRemoval (array $dependencies)
 
 postCreate (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 getLabel ()
 
 setLabel ($label)
 
 getDescription ()
 
 setDescription ($description)
 
 isTranslatable ()
 
 setTranslatable ($translatable)
 
 getSettings ()
 
 setSettings (array $settings)
 
 getSetting ($setting_name)
 
 setSetting ($setting_name, $value)
 
 isRequired ()
 
 setRequired ($required)
 
 getDefaultValue (FieldableEntityInterface $entity)
 
 getDefaultValueLiteral ()
 
 setDefaultValue ($value)
 
 getDefaultValueCallback ()
 
 setDefaultValueCallback ($callback)
 
 __sleep ()
 
 getDataType ()
 
 isList ()
 
 getClass ()
 
 getConstraints ()
 
 getConstraint ($constraint_name)
 
 getItemDefinition ()
 
 getConfig ($bundle)
 
 setConstraints (array $constraints)
 
 addConstraint ($constraint_name, $options=NULL)
 
 setPropertyConstraints ($name, array $constraints)
 
 addPropertyConstraints ($name, array $constraints)
 
- Public Member Functions inherited from ConfigEntityBase
 __construct (array $values, $entity_type)
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 isNew ()
 
 get ($property_name)
 
 set ($property_name, $value)
 
 enable ()
 
 disable ()
 
 setStatus ($status)
 
 status ()
 
 setSyncing ($syncing)
 
 isSyncing ()
 
 setUninstalling ($uninstalling)
 
 isUninstalling ()
 
 createDuplicate ()
 
 preSave (EntityStorageInterface $storage)
 
 calculateDependencies ()
 
 urlInfo ($rel= 'edit-form', array $options=[])
 
 url ($rel= 'edit-form', $options=array())
 
 link ($text=NULL, $rel= 'edit-form', array $options=[])
 
 toUrl ($rel= 'edit-form', array $options=[])
 
 getCacheTagsToInvalidate ()
 
 getDependencies ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
 onDependencyRemoval (array $dependencies)
 
 setThirdPartySetting ($module, $key, $value)
 
 getThirdPartySetting ($module, $key, $default=NULL)
 
 getThirdPartySettings ($module)
 
 unsetThirdPartySetting ($module, $key)
 
 getThirdPartyProviders ()
 
 isInstallable ()
 
 trustData ()
 
 hasTrustedData ()
 
 save ()
 
- Public Member Functions inherited from Entity
 __construct (array $values, $entity_type)
 
 id ()
 
 uuid ()
 
 isNew ()
 
 enforceIsNew ($value=TRUE)
 
 getEntityTypeId ()
 
 bundle ()
 
 label ()
 
 urlInfo ($rel= 'canonical', array $options=[])
 
 toUrl ($rel= 'canonical', array $options=[])
 
 hasLinkTemplate ($rel)
 
 link ($text=NULL, $rel= 'canonical', array $options=[])
 
 toLink ($text=NULL, $rel= 'canonical', array $options=[])
 
 url ($rel= 'canonical', $options=array())
 
 uriRelationships ()
 
 access ($operation, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 language ()
 
 save ()
 
 delete ()
 
 createDuplicate ()
 
 getEntityType ()
 
 preSave (EntityStorageInterface $storage)
 
 postSave (EntityStorageInterface $storage, $update=TRUE)
 
 postCreate (EntityStorageInterface $storage)
 
 referencedEntities ()
 
 getCacheContexts ()
 
 getCacheTagsToInvalidate ()
 
 getCacheTags ()
 
 getCacheMaxAge ()
 
 getOriginalId ()
 
 setOriginalId ($id)
 
 toArray ()
 
 getTypedData ()
 
 __sleep ()
 
 getConfigDependencyKey ()
 
 getConfigDependencyName ()
 
 getConfigTarget ()
 
- Public Member Functions inherited from RefinableCacheableDependencyInterface
 addCacheContexts (array $cache_contexts)
 
 addCacheTags (array $cache_tags)
 
 mergeCacheMaxAge ($max_age)
 
 addCacheableDependency ($other_object)
 

Static Public Member Functions

static preDelete (EntityStorageInterface $storage, array $fields)
 
static postDelete (EntityStorageInterface $storage, array $fields)
 
static loadByName ($entity_type_id, $bundle, $field_name)
 
- Static Public Member Functions inherited from FieldConfigBase
static createFromItemType ($item_type)
 
static createFromDataType ($type)
 
- Static Public Member Functions inherited from ConfigEntityBase
static sort (ConfigEntityInterface $a, ConfigEntityInterface $b)
 
- Static Public Member Functions inherited from Entity
static preCreate (EntityStorageInterface $storage, array &$values)
 
static preDelete (EntityStorageInterface $storage, array $entities)
 
static postDelete (EntityStorageInterface $storage, array $entities)
 
static postLoad (EntityStorageInterface $storage, array &$entities)
 
static load ($id)
 
static loadMultiple (array $ids=NULL)
 
static create (array $values=array())
 

Protected Member Functions

 linkTemplates ()
 
 urlRouteParameters ($rel)
 
- Protected Member Functions inherited from ConfigEntityBase
 getTypedConfig ()
 
 addDependency ($type, $name)
 
 invalidateTagsOnSave ($update)
 
- Protected Member Functions inherited from Entity
 entityManager ()
 
 entityTypeManager ()
 
 languageManager ()
 
 uuidGenerator ()
 
 linkTemplates ()
 
 urlRouteParameters ($rel)
 
 invalidateTagsOnSave ($update)
 

Protected Attributes

 $deleted = FALSE
 
 $fieldStorage
 
- Protected Attributes inherited from FieldConfigBase
 $id
 
 $field_name
 
 $field_type
 
 $entity_type
 
 $bundle
 
 $label
 
 $description = ''
 
 $settings = array()
 
 $required = FALSE
 
 $translatable = TRUE
 
 $default_value = array()
 
 $default_value_callback = ''
 
 $fieldStorage
 
 $itemDefinition
 
 $constraints = []
 
- Protected Attributes inherited from ConfigEntityBase
 $originalId
 
 $pluginConfigKey
 
 $status = TRUE
 
 $uuid
 
 $langcode = 'en'
 
 $third_party_settings = array()
 
 $_core = []
 
 $trustedData = FALSE
 
- Protected Attributes inherited from Entity
 $entityTypeId
 
 $enforceIsNew
 
 $typedData
 

Additional Inherited Members

- Static Protected Member Functions inherited from ConfigEntityBase
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 
static getConfigManager ()
 
- Static Protected Member Functions inherited from Entity
static invalidateTagsOnDelete (EntityTypeInterface $entity_type, array $entities)
 

Detailed Description

Defines the Field entity.

( id = "field_config", label = ("Field"), handlers = { "access" = "Drupal\field\FieldConfigAccessControlHandler", "storage" = "Drupal\field\FieldConfigStorage" }, config_prefix = "field", entity_keys = { "id" = "id", "label" = "label" }, config_export = { "id", "field_name", "entity_type", "bundle", "label", "description", "required", "translatable", "default_value", "default_value_callback", "settings", "field_type", } )

Constructor & Destructor Documentation

__construct ( array  $values,
  $entity_type = 'field_config' 
)

Constructs a FieldConfig object.

In most cases, Field entities are created via entity_create('field_config', $values), where $values is the same parameter as in this constructor.

Parameters
array$valuesAn array of field properties, keyed by property name. The storage associated with the field can be specified either with:
  • field_storage: the FieldStorageConfigInterface object, or by referring to an existing field storage in the current configuration with:
  • field_name: The field name.
  • entity_type: The entity type. Additionally, a 'bundle' property is required to indicate the entity bundle to which the field is attached to. Other array elements will be used to set the corresponding properties on the class; see the class property documentation for details.
See Also
entity_create()

Member Function Documentation

calculateDependencies ( )

{Calculates dependencies and stores them in the dependency property.

Returns
$this
See Also
}

Implements ConfigEntityInterface.

References ConfigEntityBase\addDependency(), ConfigEntityBase\getConfigDependencyName(), and FieldConfig\getFieldStorageDefinition().

Here is the call graph for this function:

getDisplayOptions (   $display_context)

{Returns the default display options for the field.If the field's display is configurable, the returned display options act as default values and may be overridden via the respective entity display. Otherwise, the display options will be applied to entity displays as is.

Parameters
string$display_contextThe display context. Either 'view' or 'form'.
Returns
array|null The array of display options for the field, or NULL if the field is not displayed. The following key/value pairs may be present:
  • label: (string) Position of the field label. The default 'field' theme implementation supports the values 'inline', 'above' and 'hidden'. Defaults to 'above'. Only applies to 'view' context.
  • type: (string) The plugin (widget or formatter depending on $display_context) to use, or 'hidden'. If not specified or if the requested plugin is unknown, the 'default_widget' / 'default_formatter' for the field type will be used.
  • settings: (array) Settings for the plugin specified above. The default settings for the plugin will be used for settings left unspecified.
  • third_party_settings: (array) Settings provided by other extensions through hook_field_formatter_third_party_settings_form().
  • weight: (float) The weight of the element. Not needed if 'type' is 'hidden'. The defaults of the various display options above get applied by the used entity display.
See Also
}

Implements FieldDefinitionInterface.

getFieldStorageDefinition ( )

{Returns the field storage definition.

Returns
The field storage definition.
}

Implements FieldDefinitionInterface.

References Entity\entityManager().

Referenced by FieldConfig\calculateDependencies(), FieldConfig\postCreate(), and FieldConfig\preSave().

Here is the call graph for this function:

Here is the caller graph for this function:

isComputed ( )

{Determines whether the data value is computed.For example, data could be computed depending on some other values.

Returns
bool Whether the data value is computed.
}

Implements DataDefinitionInterface.

isDeleted ( )

{Gets the deleted flag of the field.

Returns
bool Returns TRUE if the field is deleted.
}

Implements FieldConfigInterface.

isDisplayConfigurable (   $context)

{Returns whether the display for the field can be configured.

Parameters
string$display_contextThe display context. Either 'view' or 'form'.
Returns
bool TRUE if the display for this field is configurable in the given context. If TRUE, the display options returned by getDisplayOptions() may be overridden via the respective entity display.
See Also
}

Implements FieldDefinitionInterface.

isReadOnly ( )

{Determines whether the data is read-only.

Returns
bool Whether the data is read-only.
}

Implements DataDefinitionInterface.

linkTemplates ( )
protected

{}

References Drupal\moduleHandler().

Here is the call graph for this function:

static loadByName (   $entity_type_id,
  $bundle,
  $field_name 
)
static

Loads a field config entity based on the entity type and field name.

Parameters
string$entity_type_idID of the entity type.
string$bundleBundle name.
string$field_nameName of the field.
Returns
static The field config entity if one exists for the provided field name, otherwise NULL.

Referenced by CommentManager\addBodyField(), ManageFieldsTest\assertFieldSettings(), CommentCacheTagsTest\createEntity(), CommentTestBase\postComment(), CommentNonNodeTest\postComment(), CommentTestBase\setCommentSettings(), TermTest\setUp(), CommentFieldAccessTest\testAccessToAdministrativeFields(), CommentFieldsTest\testCommentDefaultFields(), CommentTypeTest\testCommentTypeEditing(), EntityReferenceSettingsTest\testConfigTargetBundleDeletion(), EntityReferenceSettingsTest\testCustomTargetBundleDeletion(), ManageFieldsTest\testDefaultValue(), FieldUIDeleteTest\testDeleteField(), ManageFieldsTest\testDeleteField(), ManageFieldsTest\testDeleteTaxonomyField(), NodeBodyFieldStorageTest\testFieldOverrides(), OptionsFloatFieldImportTest\testImport(), NodeImportCreateTest\testImportCreate(), DenormalizeTest\testMarkFieldForDeletion(), MigrateNodeTypeTest\testNodeType(), ManageFieldsTest\testPreconfiguredFields(), FileFieldValidateTest\testRequired(), SearchCommentTest\testSearchResultsComment(), SearchCommentTest\testSearchResultsCommentAccess(), ContentTranslationSettingsTest\testSettingsUI(), EntityReferenceIntegrationTest\testSupportedEntityTypesAndWidgets(), EntityLanguageTestBase\toggleFieldTranslatability(), and FileFieldTestBase\updateFileField().

Here is the caller graph for this function:

postCreate ( EntityStorageInterface  $storage)

{Acts on an entity after it is created but before hooks are invoked.

Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
}

Implements EntityInterface.

References FieldConfig\getFieldStorageDefinition(), FieldConfigBase\getName(), and Entity\label().

Here is the call graph for this function:

static postDelete ( EntityStorageInterface  $storage,
array  $fields 
)
static

{Acts on deleted entities before the delete hook is invoked.Used after the entities are deleted but before invoking the delete hook.

Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
\Drupal\Core\Entity\EntityInterface[]$entities An array of entities.
}

Implements EntityInterface.

References Drupal\entityManager().

Here is the call graph for this function:

static preDelete ( EntityStorageInterface  $storage,
array  $fields 
)
static

{Acts on entities before they are deleted and before hooks are invoked.Used before the entities are deleted and before invoking the delete hook.

Parameters
\Drupal\Core\Entity\EntityStorageInterface$storageThe entity storage object.
\Drupal\Core\Entity\EntityInterface[]$entities An array of entities.
}

Implements EntityInterface.

References Drupal\state().

Here is the call graph for this function:

preSave ( EntityStorageInterface  $storage)

Overrides ::preSave().

Exceptions
\Drupal\Core\Field\FieldExceptionIf the field definition is invalid.
\Drupal\Core\Entity\EntityStorageExceptionIn case of failures at the configuration storage level.

Implements EntityInterface.

References Entity\bundle(), Drupal\entityManager(), FieldConfig\getFieldStorageDefinition(), ConfigEntityBase\isNew(), and Drupal\service().

Here is the call graph for this function:

urlRouteParameters (   $rel)
protected

{}

References Drupal\entityManager().

Here is the call graph for this function:


The documentation for this class was generated from the following file: