Automatically create tweets for new posts

This commit is contained in:
Oliver Davies 2020-07-19 20:12:08 +01:00
parent eafcb103b8
commit f488b5c023
6 changed files with 84 additions and 7 deletions

View file

@ -22,4 +22,12 @@ class Post extends Node implements ContentEntityBundleInterface {
return (bool) $this->get('field_has_tweet')->getString();
}
public function toTweet(): string {
// TODO: Add tags.
$parts = [$this->label(), $this->url('canonical', ['absolute' => TRUE])];
return implode(PHP_EOL . PHP_EOL, $parts);
}
}