Automatically create tweets for new posts
This commit is contained in:
parent
eafcb103b8
commit
f488b5c023
6 changed files with 84 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue