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
516 B

<?php
/**
* Created by Error202
* Date: 13.08.2018
*/
namespace backend\widgets;
3 years ago
use Yii;
use yii\base\Widget;
class NotificationCountWidget extends Widget
{
public function run()
{
$count = 0;
3 years ago
if (isset(Yii::$app->params['notifications'])) {
foreach ( Yii::$app->params['notifications'] as $notification ) {
$count += $notification['count'];
}
}
return $this->render('notification-count', [
3 years ago
'notifications' => Yii::$app->params['notifications'] ?? [],
'count' => $count,
]);
}
}