[PLUGIN][Blog] Move to plugins, mistakenly was in components

This commit is contained in:
Diogo Peralta Cordeiro 2022-03-28 17:06:53 +01:00
parent 41861d284c
commit a9665177ea
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
4 changed files with 16 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -21,7 +21,7 @@ declare(strict_types = 1);
// }}}
namespace Component\Blog\Controller;
namespace Plugin\Blog\Controller;
use App\Core\ActorLocalRoles;
use App\Core\Controller;