public function LingotekContentMetadataFieldItemList::preSave in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.0.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.1.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.2.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.3.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.4.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.5.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.6.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.7.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
- 3.8.x src/Plugin/Field/LingotekContentMetadataFieldItemList.php \Drupal\lingotek\Plugin\Field\LingotekContentMetadataFieldItemList::preSave()
Defines custom presave behavior for field values.
This method is called during the process of saving an entity, just before item values are written into storage.
Overrides FieldItemList::preSave
See also
\Drupal\Core\Field\FieldItemInterface::preSave()
File
- src/
Plugin/ Field/ LingotekContentMetadataFieldItemList.php, line 90
Class
- LingotekContentMetadataFieldItemList
- A computed field that provides a content entity's Lingotek metadata.
Namespace
Drupal\lingotek\Plugin\FieldCode
public function preSave() {
/** @var \Drupal\lingotek\Entity\LingotekContentMetadata $metadata */
$metadata = $this
->getContentMetadata();
if ($metadata && !$metadata
->getContentEntityId()) {
$metadata
->setEntity($this
->getEntity());
}
parent::preSave();
}