Get template definition

@param bool|string $webAssetTemplateName false to use the current template path, or a template name to
load assets from this template instead of the current one.

@return TemplateDefinition
778724
public function getTemplateDefinition($webAssetTemplateName = false)
    {
        $ret = clone $this->templateDefinition;

        if (false !== $webAssetTemplateName) {
            $customPath = str_replace($ret->getName(), $webAssetTemplateName, $ret->getPath());
            $ret->setName($webAssetTemplateName);
            $ret->setPath($customPath);
        }

        return $ret;
    }
698881
public function forTemplate()
    {
        $link = '';
        if ($this->LinkURL) {
            $link = $this->renderWith($this->RenderTemplates);
        }
        $this->extend('updateTemplate', $link);
        return $link;
    }
1006524
protected function prepareTemplateAssets(
        TemplateDefinition $templateDefinition,
        $assets_directory,
        SmartyParser $smartyParser
    ) {
        // Get the registered template directories for the current template type
        $templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());

        // Use the template name first
        $templateDefinitionList = array_merge(
            [ $templateDefinition ],
            $templateDefinition->getParentList()
        );

        // Prepare assets for all template hierarchy.
        // Copy current template assets and its parents assets to the web/assets directory

        /** @var TemplateDefinition $templateDefinitionItem */
        foreach ($templateDefinitionList as $templateDefinitionItem) {
            // Use also the parent directories
            if (isset($templateDirectories[$templateDefinitionItem->getName()])) {
                /* create assets foreach registered directory : main @ modules */
                foreach ($templateDirectories[$templateDefinitionItem->getName()] as $key => $directory) {
                    // This is the assets directory in the template's tree
                    $tpl_path = $directory . DS . $assets_directory;

                    if (false !== $asset_dir_absolute_path = realpath($tpl_path)) {
                        $this->assetsManager->prepareAssets(
                            $asset_dir_absolute_path,
                            $this->web_root . $this->path_relative_to_web_root,
                            $templateDefinitionItem->getPath(),
                            $key . DS . $assets_directory
                        );
                    }
                }
            }
        }
    }
921293
public Template getTemplate(final String name) throws ResourceNotFoundException {
        final Template template = this.cachedTemplates.get(name);
        if (template != null) {
            return template;
        }
        return createTemplateIfAbsent(name);
    }
1007236
private function locateTemplate()
    {
        foreach ($this->bundles as $bundleName) {
            $templateName = "{$bundleName}:{$this->templatePath}";

            if ($this->engine->exists($templateName)) {
                return $templateName;
            }
        }

        throw new RuntimeException(sprintf(
            'Template "%s" not found',
            $this->templatePath
        ));
    }
527481
public function asset($filename = null)
    {
        $path = rtrim($this->config->get('plates.assets'), '/');

        if ($path && strpos($path, '://') === false && strpos($path, '//') !== 0) {
            $path = '/' . ltrim($path, '/');
        }

        $filename = ltrim($filename, '/');
        if (!$filename) {
            return $path;
        }

        return $path . '/' . $filename;
    }
811277
final private function getTemplate() {
		
		if (!$this->template or !$this->template->areKeysPopulated()) {
			$this->template = Template::getDefault();
		}
		
		// if this is derived template, load derived.php file
		if ($this->template->derived) {
			$derivedFile = $this->template->getBaseFolder() . '/'  . strtolower($this->template->name) . '/derived.php';
			if (file_exists($derivedFile)) require $derivedFile;
		}
		
		return $this->template;

	}
303523
private function getTemplateContent($templateName, $additionnalParameters = array())
    {
        $this->smarty->assign($additionnalParameters);
        return $this->module->fetch(__DIR__.'/../views/'.$templateName.'.tpl');
    }
323944
def get_template(self, template_name, **parameters):
        """"""
        template_path = pathlib.Path(self.template_dir).joinpath(template_name)
        return get_template(template_path, **parameters)
1257446
public function getTemplate() : ?string 
    {
        if ( ! $this->hasTemplate()) {
            $this->setTemplate($this->getDefaultTemplate());
        }
        return $this->template;
    }
1260235
protected function getTemplateName($fileName)
    {
        $pathFn = function ($dir) use ($fileName) {
            return static::$widgetTemplateDir . '/' . $dir . '/' . $fileName;
        };

        $pathToCheckFn = function ($path) {
            return APP_DIR . '/templates/' . $path . '.mustache';
        };

        $path = $pathFn($this->className);
        $pathToCheck = $pathToCheckFn($path);

        // If doesn't exists just take it by default from current APP
        if (!file_exists($pathToCheck)) {

            $path = $pathFn(static::$widgetTemplateDirDefault);
            $pathToCheck = $pathToCheckFn($path);

            // If doesn't exists take it by default from Knob-base
            if (!file_exists($pathToCheck)) {
                $path = '../../vendor/chemaclass/knob-base/src/templates/' . $path;
            }
        }

        return $path;
    }
481633
public function load($template)
    {
        $template = $this->findFirstExistingTemplate($template);
        if (!isset($this->loadedTemplates[ $template ])) {
            $class = $this->getTemplateClassName($template);

            $this->loadedTemplates[ $template ] = new $class($this);
            if (!$this->loadedTemplates[ $template ] instanceof Template) {
                throw new TemplatingException("The compiled class for {$template} is invalid");
            }
        }

        return $this->loadedTemplates[ $template ];
    }
1232377
@SuppressWarnings("unused")
    public Template getTemplate(String path) {
        ActContext.Base ctx = ActContext.Base.currentContext();
        if (null != ctx) {
            String curPath = ctx.templatePath();
            ctx.templateLiteral(path);
            try {
                return load(ctx);
            } finally {
                ctx.templatePath(curPath);
            }
        }
        final String templatePath = S.ensureStartsWith(path, '/');
        Template template = null;

        View defView = Act.appConfig().defaultView();

        if (null != defView) {
            template = !isTemplatePath(path) ? defView.loadInlineTemplate(path) : defView.loadTemplate(templatePath);
        }
        if (null == template && multiViews) {
            for (View view : viewList) {
                if (view == defView) continue;
                template = view.loadTemplate(templatePath);
                if (null != template) {
                    break;
                }
            }
        }
        if (null != template) {
            cache(path, template);
        }
        return template;
    }
597044
private function getMappedTemplateName(string $templateName): ?string
    {
        if (isset($this->mapping['mandatory'][$templateName])) {
            return $this->mapping['mandatory'][$templateName];
        }

        if (isset($this->mapping['optional'][$templateName])) {
            return $this->mapping['optional'][$templateName];
        }

        return null;
    }
580762
public static function getTemplate(
        string $filename,
        array $tokens = [],
        string $defaultContent = '',
        string $extension = 'tpl'
    ): string {
        if (!Str::endsWith($filename, '.' . $extension)) {
            $filename .= '.' . $extension;
        }
        if (!self::exist($filename)) {
            return $defaultContent;
        }
        $template = self::get($filename, $defaultContent);
        if ($template !== '' && count($tokens) > 0) {
            foreach ($tokens as $token => $value) {
                $template = str_replace('{' . $token . '}', $value, $template);
            }
        }
        return $template;
    }
280532
public function getTemplate($templatePath)
    {
        $absoluteTemplateFilePath = $this->getTemplateFilePath($templatePath);
        if (!$absoluteTemplateFilePath) {
            return;
        }
        extract($this->getArrayCopy());
        ob_start();
        include $absoluteTemplateFilePath;
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
602179
protected function getFluidTemplateObject($filename)
    {
        $view = GeneralUtility::makeInstance(StandaloneView::class);
        $view->setLayoutRootPaths(['EXT:backend/Resources/Private/Layouts']);
        if (\Gilbertsoft\Warranty\Utility\Adapter::isCompatVersion('8.7')) {
            $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials/ToolbarItems']);
            $view->assignMultiple([
                    'iconSize'  => 'default',
                ]);
        } else {
            $view->setPartialRootPaths(['EXT:gswarranty/Resources/Private/Partials/ToolbarItems']);
            $view->assignMultiple([
                    'iconSize'  => 'small',
                ]);
        }
        $view->setTemplateRootPaths(['EXT:gswarranty/Resources/Private/Templates/ToolbarItems']);
        $view->setTemplate($filename);

        return $view;
    }