<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Widget\Field; use ModStart\Field\AbstractField; use ModStart\Field\Text; use ModStart\Field\Type\FieldRenderMode; use Module\Member\Util\MemberCmsUtil; class AdminMemberInfo extends Text { protected $view = 'modstart::core.field.text'; protected $editable = false; protected function setup() { parent::setup(); $this->addVariables(array('memberFieldName' => null, 'formAsDisplay' => null)); } public function memberFieldName($YxV2x) { $this->addVariables(array('memberFieldName' => $YxV2x)); return $this; } public function formAsDisplay($YxV2x) { $this->addVariables(array('formAsDisplay' => $YxV2x)); return $this; } public function renderView(AbstractField $UdGHQ, $Z32UA, $OPJGK = 0) { switch ($UdGHQ->renderMode()) { case FieldRenderMode::GRID: case FieldRenderMode::DETAIL: $this->renderAsDisplay(); break; case FieldRenderMode::FORM: if ($this->getVariable('formAsDisplay')) { $this->renderAsDisplay(); } break; } return parent::renderView($UdGHQ, $Z32UA, $OPJGK); } private function renderAsDisplay() { $this->hookRendering(function (AbstractField $UdGHQ, $Z32UA, $OPJGK) { $I6OXW = $UdGHQ->column(); return MemberCmsUtil::showFromId($Z32UA->{$I6OXW}, $this->getVariable('memberFieldName')); }); } }