<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; use ModStart\Core\Util\SerializeUtil; class JsonIdItems extends AbstractField { const ITEM_STYLE_TITLE = 'title'; const ITEM_STYLE_COVER_TITLE = 'coverTitle'; protected function setup() { $this->addVariables(array('itemStyle' => self::ITEM_STYLE_TITLE, 'selectUrl' => modstart_admin_url('path/to/select'), 'previewUrl' => modstart_admin_url('path/to/preview'))); } public function itemStyle($cBDsM) { $this->addVariables(array('itemStyle' => $cBDsM)); return $this; } public function selectUrl($cBDsM) { $this->addVariables(array('selectUrl' => $cBDsM)); return $this; } public function previewUrl($cBDsM) { $this->addVariables(array('previewUrl' => $cBDsM)); return $this; } public function unserializeValue($cBDsM, AbstractField $Ldet7) { if (null === $cBDsM) { return $cBDsM; } return @json_decode($cBDsM, true); } public function serializeValue($cBDsM, $GMqtO) { return SerializeUtil::jsonEncode($cBDsM); } public function prepareInput($cBDsM, $GMqtO) { goto JolBw; eMQ1m: return $fgYNs; goto KmwPQ; TBmEV: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $cBDsM && null === $fgYNs); goto eMQ1m; JolBw: $fgYNs = @json_decode($cBDsM, true); goto TBmEV; KmwPQ: } }