Build views templates parts

@param $template

@return mixed
172230
private function buildParts($template)
    {
        $this->buildTable();
        $this->buildCreateForm();
        $this->buildEditForm();

        // Index template
        $template[0] = str_replace([
            '$ROUTE$',
            '$RESOURCE$',
            '$HEADINGS$',
            '$FIELDS$',
        ], [
            $this->route,
            $this->resource,
            $this->headings,
            $this->columns
        ], $template[0]);

        // Edit template
        $template[1] = str_replace([
            '$ROUTE$',
            '$RESOURCE$',
            '$FORMFIELDS$',
            '$MODEL$',
            '$FILES$'
        ], [
            $this->route,
            $this->resource,
            $this->formFieldsEdit,
            $this->model,
            $this->files != 0 ? "'files' => true, " : ''
        ], $template[1]);

        // Create template
        $template[2] = str_replace([
            '$ROUTE$',
            '$RESOURCE$',
            '$FORMFIELDS$',
            '$FILES$'
        ], [
            $this->route,
            $this->resource,
            $this->formFieldsCreate,
            $this->files != 0 ? "'files' => true, " : ''
        ], $template[2]);

        return $template;
    }
2384
public function parse($template)
	{

		$viewsFromConfig = $this->app['config']->get('view.paths');

		$views = array_merge((array)$viewsFromConfig, (array)$this->paths['theme']);
		$cache = $this->paths['storage'] . '/views';

		$blade = new BladeAdapter($views, $cache);

		if (!$blade->getCompiler()->isExpired($template))
		{
			return $blade->getCompiler()->getCompiledPath($template);
		}

		$blade->getCompiler()->compile($template);

		return $blade->getCompiler()->getCompiledPath($template);

	}
242483
public function render($template)
    {
        $this->setTemplate($template);
        extract($this->data);
        ob_start();
        require $this->templatePath;

        return ob_get_clean();
    }
1050763
public function resolve($template, $view = null)
    {
        if (!$template) {
            return '';
        }

        $segments = explode('/', $template);
        $page = end($segments);

        foreach ($this->baseDirectories as $dirs) {
            foreach ($dirs as $dir) {
                if ($t = $this->tryTemplate($dir, $template, $view)) {
                    return $t;
                }

                if ($t = $this->tryTemplate($dir, $template.$this->extension, $view)) {
                    return $t;
                }
            }
        }

        if ($template[0] !== '_') {

            foreach ($this->baseDirectories as $dirs) {
                foreach ($dirs as $dir) {
                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page, $view)) {
                        return $t;
                    }

                    if ($t = $this->tryTemplate($dir, 'shared'.DIRECTORY_SEPARATOR.$page.$this->extension, $view)) {
                        return $t;
                    }
                }
            }

        }

    }
543148
protected function buildStub(array $metas, &$template)
    {
        foreach($metas as $k => $v)
        {
            $template = str_replace("{{". $k ."}}", $v, $template);
        }

        return $template;
    }
899961
protected function renderTemplate($template)
    {
        // Build allowed extensions
        $allowedExtensions = new ArrayList();
        foreach (File::getAllowedExtensions() as $extension) {
            if ($extension) {
                $allowedExtensions->push(new ArrayData([
                    'Extension' => preg_quote($extension)
                ]));
            }
        }

        Config::nest();
        Config::modify()->set(SSViewer::class, 'source_file_comments', false);

        $viewer = SSViewer::create([$template]);
        $result = (string)$viewer->process(new ArrayData([
            'AllowedExtensions' => $allowedExtensions
        ]));

        Config::unnest();

        return $result;
    }
276190
protected function load($template){
		$template = get_stylesheet_directory()."/templates/admin/{$template}.php";
		/**
		 * wpametu_admin_screen_template
		 *
		 * @param string $template
		 * @param string $class_name
		 * @return string
		 */
		$template = apply_filters('wpametu_admin_screen_template', $template, get_called_class());
		if( file_exists($template) ){
			include $template;
		}
	}
675466
public function publish($template): string
    {
        $template = $template instanceof Template ? $template : Template::fromArray($template);

        $response = $this->client->publishTemplate($template);

        $etag = $response->getHeader('ETag');

        return array_shift($etag);
    }
955489
public function render($template)
    {
        $template = "{$this->directory}/{$template}";
        
        ob_start();
        ob_implicit_flush();
        
        /** @var string $template */
        if (file_exists($template)) {
            extract($this->data->toArray());
            include $template;
        } else {
            return "/** [$template] */";
        }
        
        return ob_get_clean();
    }
543759
private function fetchTemplate($template)
    {
        $resolver = $this->getResolver();
        $content  = $resolver->resolve($template);

        if (! $content) {
            throw new Exception\TemplateNotFoundException('Template by name "' . $template . '" not found');
        }

        return $content;
    }
211326
public function render_config($template)
    {
        if ($this->options['image_uploads']) {
            $this->configReplacements[':image_fields'] = "'image_fields' => [
        'image' => [
            'thumbnails' => [
                'admin' => [
                    'width' => 150,
                    'height' => null,
                    'type' => 'resize',
                ],
                'normal' => [
                    'width' => 960,
                    'height' => null,
                    'type' => 'crop',
                ],
            ],
        ],
    ],";
        }

        if ($this->options['file_uploads']) {
            $this->configReplacements[':file_fields'] = "'file_fields' => [
        'file'  => [
            'dirName' => '',
        ],
    ],";
        }

        $template = strtr($template, $this->configReplacements);

        return $template;
    }
931171
public function setTemplate($template)
    {
        $this->template = is_string($template) ? trim($template) : $template;

        return $this;
    }
592227
public function processTemplateAction($template)
    {
        try {
            if (! empty($template)) {
                // If we have a view in the URL, render this view
                return $this->render($template);
            } elseif (null != $view = $this->getRequest()->get('view')) {
                return $this->render($view);
            }
        } catch (\Exception $ex) {
            return $this->errorPage($ex->getMessage());
        }

        return $this->pageNotFound();
    }
830559
public function getTemplateFile($template)
    {
        $paths  = $this->config["path"];
        $suffix = $this->config["suffix"];

        foreach ($paths as $path) {
            $file = $path . "/" . $template . $suffix;
            if (is_file($file)) {
                return $file;
            }
        }

        throw new Exception("Could not find template file '$template'.");
    }
1320953
public function getActiveAreas($template)
    {
        $originalTemplate = $template;
        $options = get_option('modularity-options');

        // Use the ACF-options for module areas if activated
        if (get_field('acf_module_areas', 'option')) {
            $template = str_replace('.blade.php', '', $template);
            $active = get_field($template . '_active_sidebars', 'option');
        } else {
            $active = isset($options['enabled-areas'][$template]) ? $options['enabled-areas'][$template] : array();
        }

        self::$isEditing['template'] = $template;

        // Fallback
        if (is_array($active) && count($active) === 0 && !is_numeric($template) && strpos($template, 'archive-') !== false
            && !in_array($template, \Modularity\Options\Archives::getArchiveTemplateSlugs())) {
            $template = explode('-', $template, 2)[0];
            self::$isEditing['template'] = $template;
            $active = isset($options['enabled-areas'][$template]) ? $options['enabled-areas'][$template] : array();
        }

        if (self::$isEditing['title'] == 'archive-post') {
            $home = \Modularity\Helper\Wp::findCoreTemplates(array(
                'home'
            ));

            if ($home) {
                $active = isset($options['enabled-areas']['home']) ? $options['enabled-areas']['home'] : array();
                self::$isEditing['template'] = 'home';
            }
        }

        return $active;
    }
1062978
private function buildTemplate(SimpleXMLElement $template): array
    {
        if ((array) $template === []) {
            return $this->defaultTemplate();
        }

        $attributes = [];
        foreach ($template->attributes() as $attribute) {
            $attributes[$attribute->getName()] = (string) $attribute;
        }

        return $attributes;
    }
276422
public function createTemplate(Template &$template)
		{
			$form_data = array(
				'template_name' => $template->getName(),
				'template_subject' => $template->getSubject(),
				'template_body_plain' => $template->getBodyPlain(),
				'template_body_html' => $template->getBodyHtml(),
				'template_body_mobile' => $template->getBodyMobile(),
				'charset' => $template->getCharacterSet(),
				'encoding' => $template->getCharacterEncoding(),
				'folder_id' => $template->getFolderId()
			);
			$data = $this->call('createtemplate', $form_data);

			$template->setTemplateId(trim($data[1]));

			//return $template;
		}