Craft\SeomaticService::render PHP Method

render() public method

* -------------------------------------------------------------------------------- Render the SEOmatic template --------------------------------------------------------------------------------
public render ( $templatePath = "", $metaVars = null, $isPreview = false )
    public function render($templatePath = "", $metaVars = null, $isPreview = false)
    {
        if ($templatePath) {
            $htmlText = craft()->templates->render($templatePath, $metaVars);
        } else {
            $oldPath = method_exists(craft()->templates, 'getTemplatesPath') ? craft()->templates->getTemplatesPath() : craft()->path->getTemplatesPath();
            $newPath = craft()->path->getPluginsPath() . 'seomatic/templates';
            method_exists(craft()->templates, 'setTemplatesPath') ? craft()->templates->setTemplatesPath($newPath) : craft()->path->setTemplatesPath($newPath);
            /* -- Render the core template */
            $templateName = '_seo_meta';
            if ($isPreview) {
                $templateName = $templateName . 'Preview';
            }
            if ($metaVars) {
                $this->sanitizeMetaVars($metaVars);
                $htmlText = craft()->templates->render($templateName, $metaVars);
            } else {
                $htmlText = craft()->templates->render($templateName);
            }
            method_exists(craft()->templates, 'setTemplatesPath') ? craft()->templates->setTemplatesPath($oldPath) : craft()->path->setTemplatesPath($oldPath);
        }
        return $htmlText;
    }