resolveTemplate example

foreach ((\is_array($template) ? $template : [$template]) as $name) {
            // if a Template instance is passed, it might have been instantiated outside of a sandbox, check security             if ($name instanceof TemplateWrapper || $name instanceof Template) {
                $name->unwrap()->checkSecurity();
            }
        }
    }

    try {
        $loaded = null;
        try {
            $loaded = $env->resolveTemplate($template);
        } catch (LoaderError $e) {
            if (!$ignoreMissing) {
                throw $e;
            }
        }

        return $loaded ? $loaded->render($variables) : '';
    } finally {
        if ($isSandboxed && !$alreadySandboxed) {
            $sandbox->disableSandbox();
        }
    }
return array_unique($names);
    }

    /** * @return Template|TemplateWrapper */
    protected function loadTemplate($template$templateName = null, $line = null, $index = null)
    {
        try {
            if (\is_array($template)) {
                return $this->env->resolveTemplate($template);
            }

            if ($template instanceof self || $template instanceof TemplateWrapper) {
                return $template;
            }

            if ($template === $this->getTemplateName()) {
                $class = static::class;
                if (false !== $pos = strrpos($class, '___', -1)) {
                    $class = substr($class, 0, $pos);
                }
            }
Home | Imprint | This part of the site doesn't use cookies.