<?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($qGgGl) { $this->addVariables(array('memberFieldName' => $qGgGl)); return $this; } public function formAsDisplay($qGgGl) { $this->addVariables(array('formAsDisplay' => $qGgGl)); return $this; } public function renderView(AbstractField $Wvq57, $FSL7c, $xZl3o = 0) { switch ($Wvq57->renderMode()) { case FieldRenderMode::GRID: case FieldRenderMode::DETAIL: $this->renderAsDisplay(); break; case FieldRenderMode::FORM: if ($this->getVariable('formAsDisplay')) { $this->renderAsDisplay(); } break; } return parent::renderView($Wvq57, $FSL7c, $xZl3o); } private function renderAsDisplay() { $this->hookRendering(function (AbstractField $Wvq57, $FSL7c, $xZl3o) { $S1Mv_ = $Wvq57->column(); return MemberCmsUtil::showFromId($FSL7c->{$S1Mv_}, $this->getVariable('memberFieldName')); }); } }