Жёсткие диски
- 1 ответ
- 0 вопросов
1
Вклад в тег
<?php
use core\entities\Faq\FaqItem;
use core\forms\faq\FaqItemForm;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model FaqItemForm */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Ответ-Вопрос', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\backend\helpers\TemplateHelper::boxWrap($this->params);
?>
<div>
<p>
<?= Html::a('Редактирование', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'description',
[
'attribute' => 'category_id',
'format' => 'html',
'value' => function(FaqItem $model) {
return $model->getName();
},
],
],
]) ?>
</div>
public function getNameCategory()
{
return $this->hasOne(FaqCategory::className(), ['id' => 'category_id']);
}
public function getName() {
return $this->nameCategory->name;
}
[
'attribute' => 'category_id',
'format' => 'html',
'value' => function(FaqItem $model) {
return $model->getName();
},
],