/** * @param Model $model * * @return string */ public function toString(Model $model = null) { /* * Escaping warning datas */ $this->setHexAmp(true); $this->setHexApos(true); $this->setHexQuot(true); $this->setHexTag(true); $json = JsonView::toString($model); $json = str_ireplace(['u0022', 'u0027'], ['\\u0022', '\\u0027'], $json); $result = '<script type="text/javascript">' . "\n"; $result .= "\t" . $this->prefix . $this->callback . '=\'' . $json . '\';' . "\n"; $result .= '</script>' . "\n"; return $result; }
/** * @param Model $model * * @return string */ public function toString(Model $model = null) { Assert::isNotEmpty($this->callback, 'callback can not be empty!'); $json = parent::toString($model); return $this->callback . '(' . $json . ');'; }