view.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Author: lf
  4. * Blog: https://blog.feehi.com
  5. * Email: job@feehi.com
  6. * Created at: 2018-02-24 21:16
  7. */
  8. use common\libs\Constants;
  9. use yii\widgets\DetailView;
  10. /** @var $model common\models\Menu */
  11. ?>
  12. <?=DetailView::widget([
  13. 'model' => $model,
  14. 'attributes' => [
  15. 'id',
  16. 'parent_id',
  17. [
  18. 'label' => Yii::t('app', 'Parent Menu Name'),
  19. 'attribute' => 'parent_id',
  20. 'value' => function($model){
  21. return $model->parent === null ? '' : $model->parent->name;
  22. }
  23. ],
  24. 'name',
  25. 'url',
  26. 'sort',
  27. [
  28. 'attribute' => 'is_absolute_url',
  29. 'value' => function($model){
  30. return Constants::getYesNoItems($model->is_absolute_url);
  31. }
  32. ],
  33. [
  34. 'attribute' => 'target',
  35. 'value' => function($model){
  36. return Constants::getTargetOpenMethod($model->target);
  37. }
  38. ],
  39. [
  40. 'attribute' => 'is_display',
  41. 'value' => function($model){
  42. return Constants::getYesNoItems($model->is_display);
  43. }
  44. ],
  45. 'created_at:datetime',
  46. 'updated_at:datetime',
  47. ],
  48. ])
  49. ?>