Issues (281)

Branch: master

src/Frontend/Modules/Blog/Widgets/Categories.php (1 issue)

1
<?php
2
3
namespace Frontend\Modules\Blog\Widgets;
4
5
use Frontend\Core\Engine\Base\Widget as FrontendBaseWidget;
6
use Frontend\Core\Engine\Navigation as FrontendNavigation;
7
use Frontend\Modules\Blog\Engine\Model as FrontendBlogModel;
0 ignored issues
show
The type Frontend\Modules\Blog\Engine\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * This is a widget with the blog-categories
11
 */
12
class Categories extends FrontendBaseWidget
13
{
14
    public function execute(): void
15
    {
16
        parent::execute();
17
        $this->loadTemplate();
18
        $this->parse();
19
    }
20
21
    private function parse(): void
22
    {
23
        // get categories
24
        $categories = FrontendBlogModel::getAllCategories();
25
26
        // any categories?
27
        if (!empty($categories)) {
28
            // build link
29
            $link = FrontendNavigation::getUrlForBlock('Blog', 'Category');
30
31
            // loop and reset url
32
            foreach ($categories as &$row) {
33
                $row['url'] = $link . '/' . $row['url'];
34
            }
35
        }
36
37
        // assign comments
38
        $this->template->assign('widgetBlogCategories', $categories);
39
    }
40
}
41