You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
667 B
29 lines
667 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace common\modules\blog\widgets;
|
||
|
|
||
|
use common\modules\blog\entities\BlogCategory;
|
||
|
use common\modules\blog\repositories\read\BlogCategoryReadRepository;
|
||
|
use yii\base\Widget;
|
||
|
use yii\helpers\Html;
|
||
|
|
||
|
class CategoriesWidget extends Widget
|
||
|
{
|
||
|
/** @var BlogCategory|null */
|
||
|
public $active;
|
||
|
|
||
|
private $categories;
|
||
|
|
||
|
public function __construct(BlogCategoryReadRepository $categories, $config = [])
|
||
|
{
|
||
|
parent::__construct($config);
|
||
|
$this->categories = $categories;
|
||
|
}
|
||
|
|
||
|
public function run(): string
|
||
|
{
|
||
|
return $this->render('categories/categories', [
|
||
|
'categories' => $this->categories->getAll(),
|
||
|
]);
|
||
|
}
|
||
|
}
|