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