Format a template string with $data

@param string $name The template name.
@param array  $data The data to insert.

@return string
196824
public function format($name, array $data) {
        $name = $this->_getTemplateName($name, $data);
        return parent::format($name, $data);
    }
1221640
protected function newField($name=null, $data=null) {
		if($name !== null && isset($this[$name]))
			return;
		$cb = $this->cb;
		$newelement = $cb($data);
		if(!$newelement)
			return;
		$this->add($newelement, $name);
		return $newelement;
	}
387440
public static function mark($name, $context = null, $data = [])
    {
        if ($context) {
            $name .= ' / ' . $context;
        }

        $name .= sprintf('(%s)', uniqid());

        try {
            static::getInstance()->mark($name, $data);
        } catch (\Exception $e) {
            return;
        }
    }
358964
private function normalizeData($name, $data)
    {
        if (!isset($this->ignoreProcessing[$name])) {
            return array_map('trim', explode(',', $data));
        } else {
            return [$data];
        }
    }
399877
private static function _string($data, $name)
    {
        $collapsed = static::_isCollapsed(static::$_level, 1);

        if ($collapsed) {
            $collapse_style = 'style="display: none;"';
        } else {
            $collapse_style = '';
        }

        // extra
        $_ = $data;

        // Get the truncate length from the config, or default to 100
        $truncate_length = static::_config('display', 'truncate_length', 100);
        $display_cr      = static::_config('display', 'carriage_returns', true);

        $strlen = strlen($data);
        if (function_exists('mb_strlen')) {
            $strlen = mb_strlen($data, static::getCharset());
        }

        if ($strlen > $truncate_length) {
            if (function_exists('mb_substr')) {
                $_ = mb_substr($data, 0, $truncate_length - 1, static::getCharset());
            } else {
                $_ = substr($data, 0, $truncate_length - 1);
            }
            $_extra = true;
        } else {
            $_extra = false;
        }

        $icon = '';
        // Check to see if the line has any carriage returns
        if (preg_match("/\n|\r/", $data)) {
            $slash_n = substr_count($data, "\n");
            $slash_r = substr_count($data, "\r");

            $title = "Note: String contains ";

            if ($slash_n) {
                $title .= "$slash_n " . static::plural($slash_n, "new line");
            }
            if ($slash_n && $slash_r) {
                $title .= " and ";
            }
            if ($slash_r) {
                $title .= "$slash_r " . static::plural($slash_r, "carriage return");
            }

            $icon = static::get_icon("information", $title);

            // We flag this as extra so the dropdown can show the correctly formatted version
            $_extra = true;
        }

        $_ = htmlentities($_);

        // Check for and highlight any leading or trailing spaces/tabs
        if (preg_match("/^([ \t]+)|([ \t]+)$/", $data)) {
            $has_leading  = preg_match("/^([ \t]s+)/", $data);
            $has_trailing = preg_match("/([ \t]+)$/", $data);

            if ($has_leading && $has_trailing) {
                $title  = "Note: String contains trailing and leading whitespace";
            } elseif ($has_leading) {
                $title  = "Note: String contains leading whitespace";
            } elseif ($has_trailing) {
                $title  = "Note: String contains trailing whitespace";
            }

            $icon = static::get_icon("information", $title);
            $_    = preg_replace_callback( "/^([ \t]+)/", "static::convert_whitespace", $_);
            $_    = preg_replace_callback( "/([ \t]+)$/", "static::convert_whitespace", $_);
        }

        // Convert all the \r or \n to visible paragraph markers
        if ($display_cr) {
            $_ = preg_replace("/(\\r\\n|\\n|\\r)/", "<strong class=\"krumo-carrage-return\"> &para; </strong>", $_);
        } else {
            $_ = nl2br($_);
        }

        $expand_class = '';
        if ($_extra) {
            $expand_class = 'krumo-expand';
        }

        print "<li class=\"krumo-child\">";
        print "<div class=\"krumo-element $expand_class\" ";
        print "onMouseOver=\"krumo.over(this);\" onMouseOut=\"krumo.out(this);\">\n";

        print "<a class=\"krumo-name\">$name</a> ";
        print "<em class=\"krumo-type\">String(<strong class=\"krumo-string-length\">" . strlen($data) . "</strong>)</em> $icon";

        print static::get_separator() . " <strong class=\"krumo-string\">" . $_;
        // This has to go AFTER the htmlspecialchars
        if (strlen($data) > $truncate_length) {
            print "&hellip;";
        }
        print "</strong>";

        $ut = static::is_datetime($name, $data);
        if ($ut) {
            print " ~ <strong class=\"krumo-datetime\">$ut</strong>";
        }

        // callback
        if (is_callable($data)) {
            print "<span class=\"krumo-callback\"> | ";
            print "(<em class=\"krumo-type\">Callback</em>) <strong class=\"krumo-string\">" . htmlSpecialChars($_) . "()</strong></span>";
        }

        print "</div>";

        if ($_extra) {
            $data = htmlentities($data);
            $data = nl2br($data);

            print "<div class=\"krumo-nest\" $collapse_style>";
            print "<ul class=\"krumo-node\">";
            print "<li class=\"krumo-child\"> <div class=\"krumo-preview\">" . $data . "</div></li>";
            print "</ul></div>";
        }

        print "</li>";
    }
645897
public function layout($name, array $data = [])
    {
        $this->layoutName = $name;
        $this->layoutData = $data;
        $this->engine->getProject()->get('file_layout_cache')->merge([$this->file->getUid() => [$this->layoutName]]);
    }
1280946
public function block($name, array $data = [])
    {
        $view = new View();
        $view->type($this->type());
        $view->context($this->context());
        $view->set(array_merge($this->viewVars, $data));
        return $view->render($name);
    }
1214620
public static function format(array $data) {
        return array_map(function ($item) {
            $args = static::toArrOrNone($item);
            if (false !== $args) {
                return $args;
            }
            return $item;
        }, $data);
    }
1087577
protected function _object($data, $name)
    {
        
        static $objectIdList = array();
        
        $objectId = spl_object_hash($data);
        if (!isset($objectIdList[$objectId])) {
            $objectIdList[$objectId] = count($objectIdList);
        }
        
        $count      = count(@get_object_vars($data));
        $isExpand   = $count > 0 || self::$_config['dump']['showMethods'];
        $isExpanded = $this->_isExpandedLevel();

        ?>
        <li class="jbchild">
        <div class="jbelement<?php echo $isExpand ? ' jbexpand' : ''; ?> <?= $isExpanded ? 'jbopened' : ''; ?>"
            <?php if ($isExpand) { ?> onClick="jbdump.toggle(this);"<?php } ?>>
            <span class="jbname" title="splHash=<?php echo $objectId;?>"><?php echo $name; ?></span>
            (
                <span class="jbtype jbtype-object"><?php echo get_class($data); ?></span>
                <span style="text-decoration: underline;" title="splHash=<?php echo $objectId;?>">id:<?php echo $objectIdList[$objectId];?></span>,
                l:<?php echo $count; ?>
            )
        </div>
        <?php if ($isExpand) {
        $this->_vars($data, $isExpanded);
    } ?>
    <?php
    }
1181553
public static function data(Tag $tag, $name, $data) {
    $js = sprintf("data(%s, %s)",
                  JSHelper::convertString($name), JSHelper::convertValue($data)
                  );
    
    $tag->chain(new Code($js));
    
    return $tag;
  }
908131
private static function _array(&$data, $name)
	{
		?>
		<li class="krumo-child">

			<div <?php if (count($data) > 0) {?> onClick="krumo.toggle(this);"<?php } ?>
				class="krumo-element<?php echo count($data) > 0 ? ' krumo-expand' : '';?>">

					<a class="krumo-name"><?php echo $name;?></a>
					(<em class="krumo-type">Array, <strong class="krumo-array-length"><?php echo
						(count($data)==1)
							? ('1 element')
							: (count($data) . ' elements');
						?></strong></em>)
					<?php

					// callback ?
					//
					if (is_callable($data))
					{
						$_ = array_values($data);
						?>
						<span class="krumo-callback"> |
							(<em class="krumo-type">Callback</em>)
							<strong class="krumo-string"><?php
								echo htmlSpecialChars($_[0]);?>::<?php
								echo htmlSpecialChars($_[1]);?>();</strong></span>
						<?php
					}
				?>
			</div>

			<?php if (count($data))
			{
				self::_vars($data);
			} ?>
		</li>
		<?php
	}
20290
public function render($name, array $data = [])
    {
        
        //$templatePath = $this->manager->pathByName($name);
        $template = $this->twig->load($name);
        return $template->render($data);
    }
529220
public function attach($name,$data){
		$name=strtolower($name);
		$this->sqls[$name]=$data;
	}
751232
protected function getHtmlTitleFormatForPage(array $data)
    {
        if (empty($data['page']['title'])) {
            return $data['site']['name'];
        }

        return Str::replace($this->formats['page'], $data);
    }
620836
public function createFromImportedData($name, $data)
    {
        $class = new GroupClass($name);
        foreach ($data as $parameterName => $parameterData) {
            $class->addParameter($this->getGroupParameterFactory()->createFromImportedData($parameterName, $parameterData));
        }
        return $class;
    }
924171
public function render($name, array $data = [])
    {
        $content = $this->partial($name, $data);

        if (isset($this->layout)) {
            $template = new PhpTemplate($this->manager);
            $template->sections['content'] = $content;
            return $template->render($this->layout, array_merge($data, $this->layoutData));
        }
        
        return $content;
    }
1266277
public function render($name, $data = array())
    {
        // Assign to double underscored variables to avoid conflict with view parameters
        $__file = $this->getFile($name);
        $__data = $data + $this->data;
        $__layout = $this->layout;

        // Render view
        extract($__data, EXTR_OVERWRITE);
        ob_start();
        try {
            require $__file;
        } catch (\Exception $e) {
            ob_end_clean();
            throw $e;
        }
        $content = ob_get_clean();

        // If layout is configured, render layout
        if ($__layout != $this->layout) {
            $layout = $this->layout;
            $this->layout = array();
            $__data[$layout['variable']] = $content;
            $content = $this->render($layout['name'], $__data);
        }

        return $content;
    }