<?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($mdHu1) { $this->addVariables(array('itemStyle' => $mdHu1)); return $this; } public function selectUrl($mdHu1) { $this->addVariables(array('selectUrl' => $mdHu1)); return $this; } public function previewUrl($mdHu1) { $this->addVariables(array('previewUrl' => $mdHu1)); return $this; } public function unserializeValue($mdHu1, AbstractField $Mk6lP) { if (null === $mdHu1) { return $mdHu1; } return @json_decode($mdHu1, true); } public function serializeValue($mdHu1, $DRh9Q) { return json_encode($mdHu1, JSON_UNESCAPED_UNICODE); } public function prepareInput($mdHu1, $DRh9Q) { goto KGSkh; KGSkh: $L3_o5 = @json_decode($mdHu1, true); goto EBzsz; ru0Um: return $L3_o5; goto cAIva; EBzsz: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $mdHu1 && null === $L3_o5); goto ru0Um; cAIva: } }