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