diff --git a/composer.json b/composer.json index 5b8d42c..df5ce9d 100644 --- a/composer.json +++ b/composer.json @@ -50,5 +50,8 @@ "branch-alias": { "dev-master": "0.6.x-dev" } + }, + "require-dev": { + "v17development/flarum-seo": "*" } } diff --git a/src/Controller/BlogOverviewController.php b/src/Controller/BlogOverviewController.php index 9f0307b..823d9f7 100644 --- a/src/Controller/BlogOverviewController.php +++ b/src/Controller/BlogOverviewController.php @@ -3,9 +3,7 @@ namespace V17Development\FlarumBlog\Controller; use Flarum\Frontend\Document; -use Flarum\Api\Controller\ListDiscussionsController; use Flarum\Api\Client; -use Flarum\User\User; use Flarum\Extension\ExtensionManager; use Psr\Http\Message\ServerRequestInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -14,6 +12,21 @@ class BlogOverviewController { + /** + * @var Client + */ + protected $api; + + /** + * @var TranslatorInterface + */ + protected $translator; + + /** + * @var ExtensionManager + */ + protected $extensionManager; + public function __construct(Client $api, TranslatorInterface $translator, ExtensionManager $extensionManager) { $this->api = $api; @@ -26,7 +39,7 @@ public function __invoke(Document $document, ServerRequestInterface $request) $queryParams = $request->getQueryParams(); // Set meta tags - if(class_exists("V17Development\FlarumSeo\Extend")) { + if($this->extensionManager->isEnabled('v17development-seo') && class_exists("V17Development\FlarumSeo\Extend")) { // Get category if(Arr::get($queryParams, 'category')) { $category = Tag::where('slug', Arr::get($queryParams, 'category'))->firstOrFail();