You are here

protected function PublicationDateItem::isPublished in Publication Date 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/PublicationDateItem.php \Drupal\publication_date\Plugin\Field\FieldType\PublicationDateItem::isPublished()
2 calls to PublicationDateItem::isPublished()
PublicationDateItem::applyDefaultValue in src/Plugin/Field/FieldType/PublicationDateItem.php
Applies the default value.
PublicationDateItem::preSave in src/Plugin/Field/FieldType/PublicationDateItem.php
Defines custom presave behavior for field values.

File

src/Plugin/Field/FieldType/PublicationDateItem.php, line 74
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

protected function isPublished() {
  $entity = $this
    ->getEntity();
  if (!($entity instanceof FieldableEntityInterface && $entity
    ->hasField('status'))) {
    return FALSE;
  }
  return $entity
    ->get('status')->value;
}