You are here

public function PublicationDateItem::applyDefaultValue in Publication Date 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/PublicationDateItem.php \Drupal\publication_date\Plugin\Field\FieldType\PublicationDateItem::applyDefaultValue()

Applies the default value.

Parameters

bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.

Return value

$this Returns itself to allow for chaining.

Overrides CreatedItem::applyDefaultValue

File

src/Plugin/Field/FieldType/PublicationDateItem.php, line 39
Contains \Drupal\publication_date\Plugin\Field\FieldType\PublicationDateItem.

Class

PublicationDateItem
Defines the 'published_at' entity field type.

Namespace

Drupal\publication_date\Plugin\Field\FieldType

Code

public function applyDefaultValue($notify = TRUE) {
  $this
    ->setValue([
    'value' => NULL,
    'published_at_or_now' => \Drupal::time()
      ->getRequestTime(),
  ], $notify);
  return $this;
}