Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1.                     <?= Html::activeCheckboxList($model, 'category', $model->categories, [
  2.                         'item' => function($index, $label, $name, $checked, $value) use ($model) {
  3.                             $return = Html::checkbox($name, $checked, [
  4.                                 'value' => $value
  5.                             ]);
  6.                             if(intval($value) === SearchForm::CATEGORY_NEWS) {
  7.                                 $return .= ' Новости';
  8.                                 if($model->newsRecords !== null) {
  9.                                     $return .= PHP_EOL . Html::tag('span', "({$model->newsRecords})");
  10.                                 }
  11.                             } elseif(intval($value) === SearchForm::CATEGORY_ARTICLES) {
  12.                                 $return .= ' Статьи';
  13.                                 if($model->articlesRecords !== null) {
  14.                                     $return .= PHP_EOL . Html::tag('span', "({$model->articlesRecords})");
  15.                                 }
  16.                             }
  17.                             return Html::tag('label', $return, ['class' => 'b-form__checkbox']);
  18.                         }
  19.                     ])?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement