You are here

public function FieldItemBase::preSave in Zircon Profile 8

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

Defines custom presave behavior for field values.

This method is called during the process of saving an entity, just before values are written into storage. When storing a new entity, its identifier will not be available yet. This should be used to massage item property values or perform any other operation that needs to happen before values are stored. For instance this is the proper phase to auto-create a new entity for an entity reference field item, because this way it will be possible to store the referenced entity identifier.

Overrides FieldItemInterface::preSave

2 calls to FieldItemBase::preSave()
ChangedItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php
Defines custom presave behavior for field values.
PasswordItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php
Defines custom presave behavior for field values.
6 methods override FieldItemBase::preSave()
ChangedItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php
Defines custom presave behavior for field values.
DecimalItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php
Defines custom presave behavior for field values.
EntityReferenceItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Defines custom presave behavior for field values.
FieldTestItem::preSave in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/FieldTestItem.php
Defines custom presave behavior for field values.
PasswordItem::preSave in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php
Defines custom presave behavior for field values.

... See full list

File

core/lib/Drupal/Core/Field/FieldItemBase.php, line 199
Contains \Drupal\Core\Field\FieldItemBase.

Class

FieldItemBase
An entity field item.

Namespace

Drupal\Core\Field

Code

public function preSave() {
}