Get a template by name

@param string $name
@return WorkflowTemplate|null
511461
public function getNamedTemplate($name)
    {
        if ($importedTemplate = singleton(WorkflowDefinitionImporter::class)->getImportedWorkflows($name)) {
            return $importedTemplate;
        }

        if (!is_array($this->templates)) {
            return;
        }
        foreach ($this->templates as $template) {
            if ($template->getName() == $name) {
                return $template;
            }
        }
    }
805591
protected function getRequiredParameter($name)
    {
        if(!array_key_exists($name, $this->templateVars))
            throw new FiltererException('Required parameter ['.$name.'] is missing on xmodule call ['.$template->getName().']');

        return $this->templateVars[$name];
    }
66168
public function getEngine($name): TemplateEngine
    {
        $this->loadTemplateEngines();
        if (isset($this->engines[$name])) {
            return $this->engines[$name];
        }
        throw new LayoutException('Could not return engine. Engine does not exist', 1);
    }
1113763
public function getSingleTemplate(string $name): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/gitignore/templates/:name', $name));
    }
497448
public function getTemplate($name, $prefix = '')
    {
        $path = $this->getFilename($name, $prefix);

        if (!is_file($this->rootDir . '/' . $path))
        {
            throw new RuntimeException('Template not exists: ' . $path);
        }

        $tmpl = new Eresus_Template('templates/' . $path);

        return $tmpl;
    }
1213161
public function getFormWidget($name)
    {
        if (array_key_exists($name, $this->widgets)) {
            return $this->widgets[$name];
        }

        return null;
    }
688966
public function get($name)
    {
        return isset($this->collection[$name]) ? $this->collection[$name] : null;
    }
478486
public function load($name)
    {
        if (!isset($this->templates[$name])) {
            $this->templates[$name] = $this->loadFile($name);
        }

        return $this->templates[$name];
    }
1184018
public function getWorkflow($name)
    {
        $workflow = $this->getFactory()->getWorkflow($name);

        if (!$workflow instanceof WorkflowDescriptor) {
            throw new FactoryException('Unknown workflow name');
        }

        return $workflow;
    }
1116079
public static function getFormatTemplate($name) {
        $file = sprintf(
            '%s/Model/template/format/%s.html',
            __DIR__,
            $name
        );

        if (!file_exists($file)) {
            return null;
        }

        if (!isset(self::$templates[$name])) {
            self::$templates[$name] = file_get_contents($file);
        }

        return self::$templates[$name];
    }
542564
protected function getBlock($name = null)
    {
        return ($name == null) ? $this->block : (isset($this->block[$name]) ? $this->block[$name] : false);
    }
365698
public function get($name)
    {
        if ($this->flowCache->has($name)) {
            $this->flowCache->requireOnce($name);
        }

        return $this->flowCache->getWrapped($name);
    }
1227502
public function getRequiredAction($name)
    {
        $result = null;
        $actions = $this->getOption(self::OPTION_REQUIRED_ACTIONS);
        foreach ($actions as $action) {
            if ($action->getName() === $name) {
                $result = $action;
                break;
            }
        }
        return $result;
    }
1225089
function getSource($name)
    {
        if (isset($this->site->pages[$name])) {
            $content = $this->site->pages[$name];
        }
        else {
            throw new \Exception("Cannot find content \"$name\".");
        }

        if (!$content->template) {
            throw new \Exception("Content does not have a template");
        }

        if ($content->template !== 'none') {
            $block = 'content';

            // Custom Block?
            if (strpos($content->template, '::') !== false) {
                list($content->template, $block) = explode('::', $content->template);
            }

            // Create template content
            $template = "{% extends \"$content->template\" %}";
            $template .= "{% block $block %}";
            $template .= $content->content;
            $template .= "{% endblock %}";
        }
        else {
            $template = $content->content;
        }

        return $template;
    }
534904
public function getSource($name)
	{
		if (strpos($name, ':') === false) {
			throw new \Exception(
				sprintf('Oops, template file name does not seem to be in Package:file\name\path.html.twig format ("%s" given")', $name)
			);
		}

		list($packageName, $templatePath) = explode(':', $name);

		$path = $this->container->getApplication()->locateViewFile($packageName, $templatePath);

		return file_get_contents($path);
	}
579545
public function get($name)
    {
        if (!$name) {
            throw new \RuntimeException('Theme name not provided.');
        }

        $blueprints = new Blueprints('themes://');
        $blueprint = $blueprints->get("{$name}/blueprints");

        // Load default configuration.
        $file = CompiledYamlFile::instance("themes://{$name}/{$name}" . YAML_EXT);

        // ensure this is a valid theme
        if (!$file->exists()) {
            return null;
        }

        // Find thumbnail.
        $thumb = "themes://{$name}/thumbnail.jpg";
        $path = $this->grav['locator']->findResource($thumb, false);

        if ($path) {
            $blueprint->set('thumbnail', $this->grav['base_url'] . '/' . $path);
        }

        $obj = new Data((array)$file->content(), $blueprint);

        // Override with user configuration.
        $obj->merge($this->config->get('themes.' . $name) ?: []);

        // Save configuration always to user/config.
        $file = CompiledYamlFile::instance("config://themes/{$name}" . YAML_EXT);
        $obj->file($file);

        return $obj;
    }
43545
protected function getFileName($name)
    {
        $name = (string) $name;

        try {
            $template = $this->parser->parse($name);
            $file     = $this->locator->locate($template);
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', $name));
        }

        return $file;
    }