<?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($Mczr_) { $this->addVariables(array('itemStyle' => $Mczr_)); return $this; } public function selectUrl($Mczr_) { $this->addVariables(array('selectUrl' => $Mczr_)); return $this; } public function previewUrl($Mczr_) { $this->addVariables(array('previewUrl' => $Mczr_)); return $this; } public function unserializeValue($Mczr_, AbstractField $rZfgs) { if (null === $Mczr_) { return $Mczr_; } return @json_decode($Mczr_, true); } public function serializeValue($Mczr_, $vn_cr) { return SerializeUtil::jsonEncode($Mczr_); } public function prepareInput($Mczr_, $vn_cr) { goto BqARf; BqARf: $mpJUG = @json_decode($Mczr_, true); goto bIIUG; bIIUG: BizException::throwsIf($this->label . ' ' . L('Json Format Error'), $Mczr_ && null === $mpJUG); goto PflvZ; PflvZ: return $mpJUG; goto MaRk6; MaRk6: } }