Returns the available templates as needed for the flexform.

@param array $availableTemplates
@return array
161354
protected function buildSelectItemsFromAvailableTemplate($availableTemplates)
    {
        $newItems = [];
        $newItems['Use Default'] = ['Use Default', null];
        foreach ($availableTemplates as $availableTemplate) {
            $label = isset($availableTemplate['label']) ? $availableTemplate['label'] : '';
            $value = isset($availableTemplate['file']) ? $availableTemplate['file'] : '';
            $newItems[$label] = [$label, $value];
        }

        return $newItems;
    }
1366228
private function getTemplateList()
    {
        $templates = $this->getAvailableTemplates($this->bundle);

        $types = array();
        foreach ($templates as $key => $template) {
            $types[$key] = $template['name'];
        }

        return $types;
    }
704198
public static function getSource(array $compiledTemplates)
	{
		$map         = ['dynamic' => [], 'php' => [], 'static' => []];
		$tagNames    = [];
		$unsupported = [];

		// Ignore system tags
		unset($compiledTemplates['br']);
		unset($compiledTemplates['e']);
		unset($compiledTemplates['i']);
		unset($compiledTemplates['p']);
		unset($compiledTemplates['s']);

		foreach ($compiledTemplates as $tagName => $php)
		{
			$renderings = self::getRenderingStrategy($php);
			if (empty($renderings))
			{
				$unsupported[] = $tagName;
				continue;
			}

			foreach ($renderings as $i => list($strategy, $replacement))
			{
				$match = (($i) ? '/' : '') . $tagName;
				$map[$strategy][$match] = $replacement;
			}

			// Record the names of tags whose template does not contain a passthrough
			if (!isset($renderings[1]))
			{
				$tagNames[] = $tagName;
			}
		}

		$php = [];
		$php[] = '	/** {@inheritdoc} */';
		$php[] = '	public $enableQuickRenderer=true;';
		$php[] = '	/** {@inheritdoc} */';
		$php[] = '	protected $static=' . self::export($map['static']) . ';';
		$php[] = '	/** {@inheritdoc} */';
		$php[] = '	protected $dynamic=' . self::export($map['dynamic']) . ';';

		$quickSource = '';
		if (!empty($map['php']))
		{
			$quickSource = SwitchStatement::generate('$id', $map['php']);
		}

		// Build a regexp that matches all the tags
		$regexp  = '(<(?:(?!/)(';
		$regexp .= ($tagNames) ? RegexpBuilder::fromList($tagNames) : '(?!)';
		$regexp .= ')(?: [^>]*)?>.*?</\\1|(/?(?!br/|p>)[^ />]+)[^>]*?(/)?)>)s';
		$php[] = '	/** {@inheritdoc} */';
		$php[] = '	protected $quickRegexp=' . var_export($regexp, true) . ';';

		// Build a regexp that matches tags that cannot be rendered with the Quick renderer
		if (!empty($unsupported))
		{
			$regexp = '(<(?:[!?]|' . RegexpBuilder::fromList($unsupported) . '[ />]))';
			$php[]  = '	/** {@inheritdoc} */';
			$php[]  = '	protected $quickRenderingTest=' . var_export($regexp, true) . ';';
		}

		$php[] = '	/** {@inheritdoc} */';
		$php[] = '	protected function renderQuickTemplate($id, $xml)';
		$php[] = '	{';
		$php[] = '		$attributes=$this->matchAttributes($xml);';
		$php[] = "		\$html='';" . $quickSource;
		$php[] = '';
		$php[] = '		return $html;';
		$php[] = '	}';

		return implode("\n", $php);
	}
875100
private function loadTemplate()
    {
        return [
            0 => $this->template[0] != '' ? file_get_contents($this->template[0]) : '',
            1 => $this->template[1] != '' ? file_get_contents($this->template[1]) : '',
            2 => $this->template[2] != '' ? file_get_contents($this->template[2]) : '',
        ];
    }
953681
private function getTemplates(DataSourceViewInterface $dataSource)
    {
        $templates = [];

        if (isset($this->themes[$dataSource->getName()])) {
            $templates[] = $this->themes[$dataSource->getName()];
        }

        $templates[] = $this->themes[self::DEFAULT_THEME];

        return $templates;
    }
1274175
public function getTemplateBlocks($templateFileName)
    {
        $templateBlocksWithContent = [];

        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $tplDir = trim($config->getConfigParam('_sTemplateDir'), '/\\');
        $templateFileName = str_replace(['\\', '//'], '/', $templateFileName);
        if (preg_match('@/' . preg_quote($tplDir, '@') . '/(.*)$@', $templateFileName, $m)) {
            $templateFileName = $m[1];
        }

        if ($this->isShopTemplateBlockOverriddenByActiveModule()) {
            $shopId = $config->getShopId();

            $ids = $this->_getActiveModuleInfo();

            $activeModulesId = array_keys($ids);
            $activeThemeIds = oxNew(\OxidEsales\Eshop\Core\Theme::class)->getActiveThemesList();

            $templateBlockRepository = oxNew(ModuleTemplateBlockRepository::class);
            $activeBlockTemplates = $templateBlockRepository->getBlocks($templateFileName, $activeModulesId, $shopId, $activeThemeIds);

            if ($activeBlockTemplates) {
                $activeBlockTemplatesByTheme = $this->filterTemplateBlocks($activeBlockTemplates);

                $templateBlocksWithContent = $this->fillTemplateBlockWithContent($activeBlockTemplatesByTheme);
            }
        }

        return $templateBlocksWithContent;
    }
61808
protected function getTemplates($template, $merge)
    {
        $templates = explode(',', $template);

        if ($merge) {
            array_unshift($templates, 'default');
        }

        $templates = array_unique($templates);

        return $templates;
    }
885826
public function getPossibleViewFilesFromTemplates($templates)
    {
        return call_user_func_array('array_merge', array_map(function ($template) {
            return array_map(function ($extension) use ($template) {
                return str_replace('.', '/', $template).'.'.$extension;
            }, $this->extensions);
        }, $templates));
    }
917608
private function extractDistinctAvailableStateMethodNames(array $availableStates)
    {
        $methodNames = array();
        foreach ($availableStates as $availableToState) {
            $methodNames = array_unique(array_merge(
                $methodNames, $this->extractAvailableStateMethodNames($availableToState)
            ));
        }

        return $methodNames;
    }
739042
public function listTemplateFolders()
    {

        $this->setUpTemplate();
        $result = [];
        foreach ($this->templateNamespace as $ns => $paths) {
            foreach ($paths as $path) {
                $path = $this->getRootPath() . "/" . $path;
                if ($ns == "") {
                    $result[] = $path;
                } else {
                    $result[] = ['path' => $path, 'namespace' => $ns];
                }
            }
        }

        return $result;
    }
389194
public function buildTemplate()
    {
        if (!empty($this->template)) {
            return $this->template;
        }

        $actions = [];
        foreach ($this->actionBuilders as $actionBuilder) {
            $actions[] = $actionBuilder->buildTemplateAction();
        }

        $this->template = [
            'type' => TemplateType::CONFIRM,
            'text' => $this->text,
            'actions' => $actions,
        ];

        return $this->template;
    }
1157007
protected function getDependencyTemplateResources()
    {
        $templateResources = [];

        // Run through all component dependencies
        foreach ($this->dependencies as $dependency) {
            $templateResources[] = $this->objectManager->get($dependency)->getPreviewTemplateResources();
        }

        return $templateResources;
    }
1123513
public function getJobTemplateTaskTemplateList($jobTemplate)
    {
        $jobTemplateId = Utilities::getEntityId(
            $jobTemplate,
            'WindowsAzure\MediaServices\Models\JobTemplate'
        );

        $propertyList = $this->_getEntityList(
            "JobTemplates('{$jobTemplateId}')/TaskTemplates"
        );
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = TaskTemplate::createFromOptions($properties);
        }

        return $result;
    }
1354525
public function createRequiredFromTemplates($templates)
    {
        $parameters = [];
        if (!empty($templates)) {
            foreach ($templates as $template) {
                if ($template->required) {
                    $parameters[] = $this->createFromTemplate($template);
                }
            }
        }
        return $parameters;
    }
473877
public function templateExtensions()
    {
        return array(
            new Extensions\Template\Extension\Debug(
                $this->components()->debug()
            ),
            new Extensions\Template\Extension\RouteTranslator(
                'http',
                $this->builder->http()->routeTranslator()
            )
        );
    }
1288084
public function get_template_titles() {

		static $template_titles;

		if ( empty( $template_titles ) ) {
			$all_templates = (array) pods_api()->load_templates( array() );

			$template_titles = array();

			foreach ( $all_templates as $template ) {
				$template_titles[] = $template['name'];
			}
		}

		return $template_titles;

	}
999031
protected function getZonesByTemplate($template)
    {
        $zones = $this->templates[$template]['zones'];

        foreach ($zones as $key => $zone) {
            $temp = array_map([$this, 'jsString'], $zone['restricted_types']);
            $zones[$key]['restricted_types'] = '['.implode(',', $temp).']';

            $zones[$key]['restricted_types'] = json_encode($zone['restricted_types']);
        }

        return $zones;
    }