You are here

public function PublicationDateFieldItemList::preSave in Publication Date 8.2

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/FieldType/PublicationDateFieldItemList.php, line 15

Class

PublicationDateFieldItemList
Defines a item list class for publication date fields.

Namespace

Drupal\publication_date\Plugin\Field\FieldType

Code

public function preSave() {
  if ($this
    ->isEmpty()) {
    $this
      ->applyDefaultValue();
  }
  parent::preSave();
}