<?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($Gttsd) { $this->addVariables(array('itemStyle' => $Gttsd)); return $this; } public function selectUrl($Gttsd) { $this->addVariables(array('selectUrl' => $Gttsd)); return $this; } public function previewUrl($Gttsd) { $this->addVariables(array('previewUrl' => $Gttsd)); return $this; } public function unserializeValue($Gttsd, AbstractField $acdQI) { if (null === $Gttsd) { return $Gttsd; } return @json_decode($Gttsd, true); } public function serializeValue($Gttsd, $BWo2e) { return json_encode($Gttsd, JSON_UNESCAPED_UNICODE); } public function prepareInput($Gttsd, $BWo2e) { goto elqRQ; elqRQ: $RCoRX = @json_decode($Gttsd, true); goto cVzSP; LByyg: return $RCoRX; goto t0AO0; cVzSP: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $Gttsd && null === $RCoRX); goto LByyg; t0AO0: } }