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.

30 lines
459 B

7 years ago
<?php
/**
* Created by Error202
* Date: 30.01.2018
*/
namespace frontend\widgets\post;
use core\entities\post\PostCategory;
use yii\base\Widget;
class PostCategoriesWidget extends Widget
{
3 years ago
public int $type_id;
7 years ago
3 years ago
public function run(): string
{
7 years ago
$categories = PostCategory::find()->byType($this->type_id)->all();
if (count($categories) < 2) {
return '';
}
return $this->render('categories', [
'categories' => $categories,
]);
}
3 years ago
}