. // }}} namespace Plugin\Blog; use App\Core\Event; use function App\Core\I18n\_m; use App\Core\Modules\Plugin; use App\Core\Router; use App\Util\Common; use App\Util\HTML; use EventResult; use Plugin\Blog\Controller as C; class Blog extends Plugin { public function onAddRoute(Router $r): EventResult { $r->connect(id: 'blog_post', uri_path: '/blog/post', target: [C\Post::class, 'makePost']); return Event::next; } /** * @param (array{actor: \App\Entity\Actor} & array) $vars * @param array $res */ public function onAppendCardProfile(array $vars, array &$res): EventResult { $actor = Common::actor(); $group = $vars['actor']; if (!\is_null($actor) && $group->isGroup()) { $res[] = HTML::html(['a' => ['attrs' => ['href' => Router::url('blog_post', ['in' => $group->getId()]), 'title' => _m('Make a new blog post'), 'class' => 'profile-extra-actions'], _m('Post in blog')]]); } return Event::next; } }