diff --git a/components/Group/Group.php b/components/Group/Group.php index 0b254790da..ff32d1bcbf 100644 --- a/components/Group/Group.php +++ b/components/Group/Group.php @@ -79,7 +79,6 @@ class Group extends Component $url = Router::url('group_actor_settings', ['id' => $group->getId()]); $res[] = HTML::html(['a' => ['attrs' => ['href' => $url, 'title' => _m('Edit group settings'), 'class' => 'profile-extra-actions'], _m('Group settings')]]); } - $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; } diff --git a/components/Blog/Blog.php b/plugins/Blog/Blog.php similarity index 64% rename from components/Blog/Blog.php rename to plugins/Blog/Blog.php index 520cdd8f6f..4d4fdab3c1 100644 --- a/components/Blog/Blog.php +++ b/plugins/Blog/Blog.php @@ -20,12 +20,15 @@ declare(strict_types = 1); // }}} -namespace Component\Blog; +namespace Plugin\Blog; use App\Core\Event; use App\Core\Modules\Plugin; use App\Core\Router; -use Component\Blog\Controller as C; +use App\Util\Common; +use App\Util\HTML; +use Plugin\Blog\Controller as C; +use function App\Core\I18n\_m; class Blog extends Plugin { @@ -34,4 +37,14 @@ class Blog extends Plugin $r->connect(id: 'blog_post', uri_path: '/blog/post', target: [C\Post::class, 'makePost']); return Event::next; } + + public function onAppendCardProfile(array $vars, array &$res): bool + { + $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; + } } diff --git a/components/Blog/Controller/Post.php b/plugins/Blog/Controller/Post.php similarity index 99% rename from components/Blog/Controller/Post.php rename to plugins/Blog/Controller/Post.php index ab38d05382..3575e741a9 100644 --- a/components/Blog/Controller/Post.php +++ b/plugins/Blog/Controller/Post.php @@ -21,7 +21,7 @@ declare(strict_types = 1); // }}} -namespace Component\Blog\Controller; +namespace Plugin\Blog\Controller; use App\Core\ActorLocalRoles; use App\Core\Controller; diff --git a/components/Blog/templates/blog/make_post.html.twig b/plugins/Blog/templates/blog/make_post.html.twig similarity index 100% rename from components/Blog/templates/blog/make_post.html.twig rename to plugins/Blog/templates/blog/make_post.html.twig