<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Field; use ModStart\Core\Util\ConvertUtil; use Module\Vendor\Markdown\MarkdownUtil; class Html extends AbstractField { protected $html = ''; protected $plain = false; protected $isLayoutField = true; public function html($pbwAU) { $this->html = $pbwAU; return $this; } public function htmlContent($pbwAU) { $this->html = '<div class="ub-html">' . $pbwAU . '</div>'; return $this; } public function htmlContentFromMarkdown($gBZhn) { goto GA9qJ; pLLq_: $this->html = '<div class="ub-html">' . $pbwAU . '</div>'; goto nqDpf; GA9qJ: $pbwAU = MarkdownUtil::convertToHtml($gBZhn); goto pLLq_; nqDpf: return $this; goto Yk73d; Yk73d: } public function htmlPlain($pbwAU) { goto YzIS6; z2o0u: return $this; goto ON7dw; YzIS6: $this->html = $pbwAU; goto OQpB5; OQpB5: $this->plain = true; goto z2o0u; ON7dw: } public function plain($HA9Q5 = true) { $this->plain = $HA9Q5; return $this; } public function render() { goto RPnFy; RPnFy: if ($this->html instanceof \Closure) { $this->html = ConvertUtil::render($this->html->call($this->variables(), $this->context)); } goto zddcG; BsFLc: $AqEmT = $this->label ? $this->label . ':' : ''; goto u379v; rAr2l: $cfkkR = $this->rules(); goto PRgZg; u379v: return "<div class=\"line\">\n    <div class=\"label\">\n        {$yOG1s}\n        {$AqEmT}\n    </div>\n    <div class=\"field\">\n        {$this->html}\n    </div>\n</div>"; goto fnXth; zddcG: if ($this->plain) { return $this->html; } goto rAr2l; PRgZg: $yOG1s = in_array('required', $cfkkR) ? '<span class="ub-text-danger ub-text-bold">*</span>' : ''; goto BsFLc; fnXth: } }