Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calcio/c3b5e5d3c8d274fab36ef0047e21fe29 to your computer and use it in GitHub Desktop.
Save calcio/c3b5e5d3c8d274fab36ef0047e21fe29 to your computer and use it in GitHub Desktop.
DetailView::widget() - arquivo view.php
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\modules\admin\models\Category */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Categories'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-view">
<h1><?= Yii::t('app', 'Category') ?>: <?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Novo', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'template' => '<tr><th{captionOptions} class="col-sm-2">{label}</th><td{contentOptions}>{value}</td></tr>',
'attributes' => [
'id',
'name',
'status:status',
'created_at:date',
'updated_at:date',
],
]) ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment