<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Exception\BizException; 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($gwXrh) { $this->addVariables(array('itemStyle' => $gwXrh)); return $this; } public function selectUrl($gwXrh) { $this->addVariables(array('selectUrl' => $gwXrh)); return $this; } public function previewUrl($gwXrh) { $this->addVariables(array('previewUrl' => $gwXrh)); return $this; } public function unserializeValue($gwXrh, AbstractField $VWt5t) { if (null === $gwXrh) { return $gwXrh; } return @json_decode($gwXrh, true); } public function serializeValue($gwXrh, $uV19D) { return json_encode($gwXrh, JSON_UNESCAPED_UNICODE); } public function prepareInput($gwXrh, $uV19D) { goto Si250; Si250: $bG1t2 = @json_decode($gwXrh, true); goto sKCQo; sKCQo: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $gwXrh && null === $bG1t2); goto qL7L8; qL7L8: return $bG1t2; goto BRk52; BRk52: } }