<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Util\SerializeUtil; class ComplexFields extends AbstractField { protected $width = 300; protected $listable = false; protected function setup() { $this->addVariables(array('fields' => array(), 'iconServer' => modstart_admin_url('widget/icon'))); } private function getDefaultValues() { goto S2lB3; S2lB3: $WJIdC = $this->getVariable('fields'); goto IA9CC; IA9CC: $snkf0 = array(); goto rqwst; FETdw: return $snkf0; goto q9TFD; rqwst: foreach ($WJIdC as $Sch6x) { $snkf0[$Sch6x['name']] = isset($Sch6x['defaultValue']) ? $Sch6x['defaultValue'] : null; } goto FETdw; q9TFD: } public function iconServer($YSNPl) { $this->addVariables(array('iconServer' => $YSNPl)); return $this; } public function fields($HDpl6) { goto brO6y; brO6y: $this->addVariables(array('fields' => $HDpl6)); goto lXVOf; lXVOf: $this->defaultValue($this->getDefaultValues()); goto ON5ad; ON5ad: return $this; goto jPH3R; jPH3R: } public function unserializeValue($HDpl6, AbstractField $E8QRJ) { goto e9eqa; e9eqa: if (null === $HDpl6) { return $HDpl6; } goto bYuJU; AQ_a5: return $HDpl6; goto Jc_Lr; bYuJU: $HDpl6 = @json_decode($HDpl6, true); goto KNXBO; KNXBO: if (empty($HDpl6)) { $HDpl6 = new \stdClass(); } goto AQ_a5; Jc_Lr: } public function serializeValue($HDpl6, $xTADA) { return SerializeUtil::jsonEncode($HDpl6); } public function prepareInput($HDpl6, $xTADA) { goto zP4qd; AvWBC: if (empty($HDpl6)) { $HDpl6 = new \stdClass(); } goto aTpNE; zP4qd: $HDpl6 = @json_decode($HDpl6, true); goto AvWBC; aTpNE: return $HDpl6; goto RNX4u; RNX4u: } }