public function FieldNewValue::getValue

Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().

Overrides TypedData::getValue

File

drupal/core/modules/comment/lib/Drupal/comment/FieldNewValue.php, line 24
Contains \Drupal\comment\FieldNewValue.

Class

FieldNewValue
A computed property for the integer value of the 'new' field.

Namespace

Drupal\comment

Code

public function getValue() {
  if (!isset($this->value)) {
    if (!isset($this->parent)) {
      throw new InvalidArgumentException('Computed properties require context for computation.');
    }
    $field = $this->parent
      ->getParent();
    $entity = $field
      ->getParent();
    $this->value = node_mark($entity->nid->target_id, $entity->changed->value);
  }
  return $this->value;
}