Pimcore\Model\Document\Tag\Renderlet::frontend PHP Метод

frontend() публичный Метод

См. также: Document\Tag\TagInterface::frontend
public frontend ( ) : string
Результат string
    public function frontend()
    {
        if (!$this->options["controller"] && !$this->options["action"]) {
            $this->options["controller"] = Config::getSystemConfig()->documents->default_controller;
            $this->options["action"] = Config::getSystemConfig()->documents->default_action;
        }
        $document = null;
        if ($this->o instanceof Document) {
            $document = $this->o;
        }
        if (method_exists($this->o, "isPublished")) {
            if (!$this->o->isPublished()) {
                return "";
            }
        }
        if ($this->o instanceof Element\ElementInterface) {
            $blockparams = ["action", "controller", "module", "template"];
            $params = ["template" => isset($this->options["template"]) ? $this->options["template"] : null, "object" => $this->o, "element" => $this->o, "document" => $document, "id" => $this->id, "type" => $this->type, "subtype" => $this->subtype, "pimcore_request_source" => "renderlet", "disableBlockClearing" => true];
            foreach ($this->options as $key => $value) {
                if (!array_key_exists($key, $params) && !in_array($key, $blockparams)) {
                    $params[$key] = $value;
                }
            }
            if ($this->getView() != null) {
                try {
                    $content = $this->getView()->action($this->options["action"], $this->options["controller"], isset($this->options["module"]) ? $this->options["module"] : null, $params);
                    return $content;
                } catch (\Exception $e) {
                    if (\Pimcore::inDebugMode()) {
                        return "ERROR: " . $e->getMessage() . " (for details see debug.log)";
                    }
                    Logger::error($e);
                }
            }
        }
    }