当前位置: 首页>>代码示例>>PHP>>正文


PHP DetailView::className方法代码示例

本文整理汇总了PHP中yii\widgets\DetailView::className方法的典型用法代码示例。如果您正苦于以下问题:PHP DetailView::className方法的具体用法?PHP DetailView::className怎么用?PHP DetailView::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\widgets\DetailView的用法示例。


在下文中一共展示了DetailView::className方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\DetailView;
use asdfstudio\admin\components\AdminFormatter;
/**
 * @var yii\web\View $this
 * @var yii\db\ActiveRecord $model
 * @var asdfstudio\admin\base\Entity $entity
 */
$this->title = $entity->labels()[0];
$this->params['breadcrumbs'][] = ['label' => $entity->labels()[1], 'url' => ['manage/index', 'entity' => $entity->id]];
$this->params['breadcrumbs'][] = Yii::t('admin', 'View');
$detail = $entity->detail();
$class = ArrayHelper::remove($detail, 'class', DetailView::className());
$defaultDetail = ['model' => $model, 'formatter' => ['class' => AdminFormatter::className()]];
$detail = ArrayHelper::merge($defaultDetail, $detail);
$primaryKey = $entity->primaryKey();
?>
<div class="model-view">
    <p>
        <?php 
echo Html::a(Yii::t('admin', 'Edit'), ['update', 'entity' => $entity->id, 'id' => $model->{$primaryKey}], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('admin', 'Delete'), ['delete', 'entity' => $entity->id, 'id' => $model->{$primaryKey}], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('admin', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <div class="row">
开发者ID:dawei101,项目名称:yii2-admin-module,代码行数:31,代码来源:view.php

示例2: detail

 /**
  * Detail view of model
  * Default detail view class is `asdfstudio\admin\details\Detail`
  * For configuration syntax see [[asdfstudio\admin\details\Detail]]
  *
  * ```php
  *  return [
  *      'class' => vendorname\blog\details\PostDetail::className(),
  *  ];
  * ```
  *
  * @return array
  */
 public function detail()
 {
     return ['class' => DetailView::className()];
 }
开发者ID:asdf-studio,项目名称:yii2-admin-module,代码行数:17,代码来源:Entity.php


注:本文中的yii\widgets\DetailView::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。