get('field_external_link')->get(0)) ? $link->getValue() : NULL; } public function hasBeenSentToSocialMedia(): bool { return (bool) $this->get('field_sent_to_social_media')->getString(); } public function hasTweet(): bool { return (bool) $this->get('field_has_tweet')->getString(); } public function isExternalPost(): bool { return (bool) $this->getExternalLink(); } public function toTweet(): string { // TODO: Add tags. $parts = [$this->label(), $this->url('canonical', ['absolute' => TRUE])]; return implode(PHP_EOL . PHP_EOL, $parts); } }