core/Field.php
public function code($attr = null)
    {
        if ($attr === null || !is_array($attr)) {
            $attr = [];
        }
        try {
            if ($this->form != null) {
                $this->form->createDynamic($this);
            }
            $box = self::getInstance($this->type);
            if ($box === null) {
                throw new \Exception('Unsupported input box type:' . $this->type);
            }
            if (!empty($this->viewTemplate)) {
                $template = $this->viewTemplate;
                $this->viewTemplate = null;
                $view = new View();
                $view->assign('form', $this->form);
                $view->assign('field', $this);
                $view->assign('attr', $attr);
                $data = $view->fetch($template);
                return $data;
            }
            return $box->code($this, $attr);
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
public function code($attr = null)
    {
        if ($attr === null || !is_array($attr)) {
            $attr = [];
        }
        try {
            if ($this->form != null) {
                $this->form->createDynamic($this);
            }
            $box = self::getInstance($this->type);
            if ($box === null) {
                throw new \Exception('Unsupported input box type:' . $this->type);
            }
            if (!empty($this->viewTemplate)) {
                $template = $this->viewTemplate;
                $this->viewTemplate = null;
                $view = new View();
                $view->assign('form', $this->form);
                $view->assign('field', $this);
                $view->assign('attr', $attr);
                $data = $view->fetch($template);
                return $data;
            }
            return $box->code($this, $attr);
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
获取插件显示的代码
@param null $attr
@return mixed|string|void
@throws \Exception