Initialize the template with values.

@param Template $objTemplate The Template instance to populate.
@param array    $arrRowData  The row data for the current item.
@param ISimple  $objSettings The render settings to use for this attribute.

@return void
494471
public function prepareTemplate(Template $objTemplate, $arrRowData, $objSettings)
    {
        parent::prepareTemplate($objTemplate, $arrRowData, $objSettings);

        $base = Environment::get('base');
        $lang = $this->getActiveLanguageArray();

        $strEmpty = $this->ensureImage(
            $this->get('rating_emtpy'),
            'bundles/metamodelsattributerating/star-empty.png'
        );
        $strFull  = $this->ensureImage(
            $this->get('rating_full'),
            'bundles/metamodelsattributerating/star-full.png'
        );
        $strHover = $this->ensureImage(
            $this->get('rating_hover'),
            'bundles/metamodelsattributerating/star-hover.png'
        );

        if (\file_exists(TL_ROOT . '/' . $strEmpty)) {
            $size = \getimagesize(TL_ROOT . '/' . $strEmpty);
        } else {
            $size = \getimagesize(TL_ROOT . '/web/' . $strEmpty);
        }
        $objTemplate->imageWidth = $size[0];
        $objTemplate->rateHalf   = $this->get('rating_half') ? 'true' : 'false';
        $objTemplate->name       = 'rating_attribute_'.$this->get('id').'_'.$arrRowData['id'];

        $objTemplate->ratingDisabled = (
            $this->scopeDeterminator->currentScopeIsBackend()
            || $objSettings->get('rating_disabled')
            || $this->getSessionBag()->get($this->getLockId($arrRowData['id']))
        );

        $value  = ($this->get('rating_max') * (float) $arrRowData[$this->getColName()]['meanvalue']);
        $intInc = \strlen($this->get('rating_half')) ? .5 : 1;

        $objTemplate->currentValue = (\round(($value / $intInc), 0) * $intInc);
        $objTemplate->tipText      = \sprintf(
            $lang['metamodel_rating_label'],
            '[VALUE]',
            $this->get('rating_max')
        );
        $objTemplate->ajaxUrl      = $this->router->generate('metamodels.attribute_rating.rate');
        $objTemplate->ajaxData     = \json_encode(
            [
                'id'   => $this->get('id'),
                'pid'  => $this->get('pid'),
                'item' => $arrRowData['id'],
            ]
        );

        $arrOptions = [];
        $intValue   = $intInc;

        while ($intValue <= $this->get('rating_max')) {
            $arrOptions[] = $intValue;
            $intValue    += $intInc;
        }
        $objTemplate->options = $arrOptions;

        $objTemplate->imageEmpty = $base.$strEmpty;
        $objTemplate->imageFull  = $base.$strFull;
        $objTemplate->imageHover = $base.$strHover;
    }
853569
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $dataText = $originalContentObjectAttribute->content();
            $contentObjectAttribute->setContent( $dataText );
        }
        else
        {
            $default = array( 'value' => array() );
            $contentObjectAttribute->setContent( $default );
        }
    }
660186
private function parseTemplatingSettings(\DOMNode $templating) {

		if(is_null($this->templating)) {
			$this->templating = new \stdClass;
			$this->templating->filters = [];
		}

		$xpath = new \DOMXPath($templating->ownerDocument);

		foreach($xpath->query("filters/filter", $templating) as $filter) {

			$id = $filter->getAttribute('id');
			$class = $filter->getAttribute('class');

			if(!$id) {
				throw new ConfigException('Templating filter without id found.');
			}

			if(!$class)	{
				throw new ConfigException(sprintf("No class for templating filter '%s' configured.", $id));
			}

			if(isset($this->templating->filters[$id])) {
				throw new ConfigException(sprintf("Templating filter '%s' has already been defined.", $id));
			}

			// clean path delimiters, prepend leading backslash, and replace slashes with backslashes

			$class = '\\' . ltrim(str_replace('/', '\\', $class), '/\\');

			// store parsed information

			$this->templating->filters[$id] = [
				'class' => $class,
				'parameters' => $filter->getAttribute('parameters')
			];

		}

	}
864593
public function setLayout($template) {
		$layout = $this->getTemplatePathname($template);
		if(!is_file($layout)) {
			throw new \RuntimeException("Layout file `$template` does not exist.");
		} else {
			$this->layout = $template;
		}
	}
66149
public function processRecord(NodeTemplate $nodeTemplate, array $data)
    {
        $this->unsetAllNodeTemplateProperties($nodeTemplate);

        $externalIdentifier = $this->getExternalIdentifierFromRecordData($data);
        $nodeName = $this->renderNodeName($externalIdentifier);
        if (!isset($data['uriPathSegment'])) {
            $data['uriPathSegment'] = Slug::create($this->getLabelFromRecordData($data))->getValue();
        }

        $recordMapping = $this->getNodeProcessing($externalIdentifier);
        if ($recordMapping !== null) {
            $node = $this->storageNode->getContext()->getNodeByIdentifier($recordMapping->getNodeIdentifier());
            if ($node === null) {
                throw new \Exception(sprintf('Failed retrieving existing node for update. External identifier: %s Node identifier: %s. Maybe the record mapping in the database does not match the existing (imported) nodes anymore.', $externalIdentifier, $recordMapping->getNodeIdentifier()), 1462971366085);
            }
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $node);

        } else {
            $nodeTemplate->setNodeType($this->nodeType);
            $nodeTemplate->setName($nodeName);
            $this->applyProperties($this->getPropertiesFromDataProviderPayload($data), $nodeTemplate);

            $node = $this->createNodeFromTemplate($nodeTemplate, $data);
            $this->registerNodeProcessing($node, $externalIdentifier);
        }

        $this->dimensionsImporter->process($node, $this->getPropertiesFromDataProviderPayload($data), $this->currentEvent);

        return $node;
    }
94869
public function render($template, $data = null)
    {
        $this->templateName = $template;
        $this->templateFile = $this->getTemplatePathname($template);

        if (!is_file($this->templateFile))
        {
            throw new \RuntimeException("Slimore\\Mvc\\View cannot render `$template` because the template does not exist");
        }

        $this->setCompileDirectory();
        $this->setCompileFile($template);

        ob_start();

        $data = array_merge($this->data->all(), (array) $data);
        $data = array_merge(static::$globals, $data);

        static::getProperties([
            'data'               => $data,
            'compileCached'      => $this->compileCached,
            'templatePath'       => $this->getTemplatesDirectory() . DIRECTORY_SEPARATOR,
            'compilePath'        => $this->compilePath,
            'compileFileNameMd5' => $this->compileFileNameMd5,
            'compileFileSuffix'  => $this->compileFileSuffix
        ]);

        extract($data);

        //echo "this->compileCached =>" . ($this->compileCached ? 'true' : 'false');

        if (!$this->compileCached)
        {
            $tpl = $this->read($this->templateFile);
            $tpl = static::parser($tpl);
            $this->write($this->templateCompileFile, $tpl);
        }
        else
        {
            if (!file_exists($this->templateCompileFile) ||
                (filemtime($this->templateFile) > filemtime($this->templateCompileFile))
            ) {
                $tpl = $this->read($this->templateFile);
                $tpl = static::parser($tpl);
                $this->write($this->templateCompileFile, $tpl);
            }
        }

        require $this->templateCompileFile;

        echo ob_get_clean();
    }
752311
public function render($template, array $data = [])
    {
        $isString = is_string($template);

        if ($isString && is_file($template)) {
            return $this->renderTemplate($template, $data);
        }
        if (! $isString && ! is_array($template)) {
            throw new InvalidArgumentException('Template must be a string or an array of strings.');
        }
        $path = $this->find($template);
        if ($path) {
            return $this->doRender($path, $data);
        }
        if ($isString) {
            throw new RuntimeException($template.' is not a valid template name.');
        }

        throw new RuntimeException('Not found any valid template in the array provided.');
    }
1178660
function () {
    var atts = this.atts, att, ctlAtt, eh = this.eh, ctl = this.controller, v;
    var vs = this.isCptAttElement? this.vscope : this.parent.vscope;
    if (atts && ctl && ctl.$attributes) {
      // this template has a controller
      // let's propagate the new attribute values to the controller attributes
      for (var i = 0, sz = this.atts.length; sz > i; i++) {
        att = atts[i];
        ctlAtt = ctl.$attributes[att.name];
        // propagate changes for 1- and 2-way bound attributes
        if (ctlAtt.type!=="template" && ctlAtt._binding !== 0) {
          v = att.getValue(eh, vs, null);
          if (ctlAtt.type==="object" || ctlAtt.type==="array") {
            json.set(ctl, att.name, v);
          } else if ('' + v != '' + ctl[att.name]) {
            // values may have different types - this is why we have to check that values are different to
            // avoid creating loops
            json.set(ctl, att.name, v);
          }
        }
      }
    }
  }
933682
protected function templateToString($template, array $data)
    {

        $templateFullName = $this->getTemplateFullName($template);

        if (!is_file($templateFullName)) {
            throw new RuntimeException("View cannot render `$template` because the template does not exist");
        }

        $fullData = array_merge($this->attributes, $data);
        $this->levelStartObcache = ob_get_level();
        $this->startSection($this->courentSection);
        $this->protectedIncludeScope($templateFullName, $fullData);
        $output = $this->endSection(true);
        $this->sectionContent[self::CONTENT] = $this->sectionContent[self::C_CONTENT];
        unset($this->sectionContent[self::C_CONTENT]);
        while (ob_get_level() > $this->levelStartObcache) {
            ob_end_clean();
        }

        if (!empty($this->layout)) {
            $layout = $this->layout;
            $this->layout = '';
            return $this->templateToString($layout, $fullData);
        }

        return $output;
    }
365002
public function initializeObject()
    {
        parent::initializeObject();

        $this->setPathsFromOptions();
        $this->setFormat('html');

        // Doesn't work without setting rendering context.
        // Even if StandaloneView works and we just extend it.
        $renderingContent = new RenderingContext;
        $renderingContent->setControllerContext($this->controllerContext);
        $this->setRenderingContext($renderingContent);
    }
1202206
protected function loadTemplates()
    {
        $templates = $this->templatesObjectBackend->loadObject();
        if (!is_array($templates)) {
            $templates = array();
        }
        
        $this->templates = $templates;
    }
1033064
function () {
                var children = [],
                    addedDescriptors = [],
                    i, child;

                if (this.$defaultContentName && this.$defaultTemplateName) {
                    throw "both $defaultContentName and $defaultTemplateName are defined";
                }

                var desc;

                function addChildren(childrenFromDescriptor, fromDescriptor) {

                    // don't add children with the same descriptor twice
                    for (var j = 0; j < childrenFromDescriptor.length; j++) {
                        child = childrenFromDescriptor[j];
                        child.$fromDescriptor = fromDescriptor;

                        if (child.$createdByTemplate || _.indexOf(addedDescriptors, child.$descriptor) === -1) {
                            children.push(child);
                            if (child.$descriptor) {
                                addedDescriptors.push(child.$descriptor);
                            }
                        }
                    }
                }

                for (var d = 0; d < this.$internalDescriptors.length; d++) {
                    desc = this.$internalDescriptors[d];
                    addChildren(this._getChildrenFromDescriptor(desc, this, null, this), "intern");
                }

                var externalDescriptorChildren;

                if (this.$defaultTemplateName) {
                    var templateBlock;

                    // go through all children from the external descriptor
                    // and check if a template block with the name $defaultTemplateName

                    for (i = 0; i < this.$descriptor.childNodes.length; i++) {
                        var node = this.$descriptor.childNodes[i];

                        if (node.nodeType === 1 &&
                            node.getAttribute("name") === this.$defaultTemplateName &&
                            this.$stage.$applicationContext.getFqClassName(node.namespaceURI, this._localNameFromDomNode(node), true) === "js/core/Template") {

                            templateBlock = node;
                            break;
                        }
                    }

                    if (!templateBlock && this.$descriptor) {
                        templateBlock = this.createComponent(Component.Template, {
                            name: this.$defaultTemplateName
                        }, this.$descriptor);

                        externalDescriptorChildren = [templateBlock];
                    }

                }

                externalDescriptorChildren = externalDescriptorChildren || this._getChildrenFromDescriptor(this.$descriptor);


                if (this.$defaultContentName && this.$descriptor) {
                    // check if content block is already defined
                    var contentBlock,
                        internAndExternalChildren = children.concat(externalDescriptorChildren);


                    for (i = 0; i < internAndExternalChildren.length; i++) {
                        child = internAndExternalChildren[i];

                        if (child instanceof Component.Content && child.$.name === this.$defaultContentName) {
                            // content block already defined
                            contentBlock = child;
                            break;
                        }
                    }

                    if (!contentBlock) {
                        // create a content block and move all children in a js.core.Content Block
                        contentBlock = this.createComponent(Component.Content, {
                            name: this.$defaultContentName
                        });

                        // add all children to content block
                        for (i = 0; i < externalDescriptorChildren.length; i++) {
                            contentBlock.addChild(externalDescriptorChildren[i]);
                        }

                        externalDescriptorChildren = [contentBlock];
                    }

                }

                addChildren(externalDescriptorChildren, "external");

                var extraChildren = this.createChildren();
                if (extraChildren) {
                    addChildren(extraChildren, "extra");
                }

                this._initializeChildren(children);

                this._childrenInitialized();

                this._initializeXamlEventAttributes(this.$xamlDefaults, this);
                this._initializeXamlEventAttributes(this.$xamlAttributes, this.$rootScope);
            }
738766
private function _renderTemplate($template, $vars)
	{
		extract($vars, EXTR_SKIP);
		ob_start();

		try
		{
			require($template);
			$contents = ob_get_contents();
		}
		catch (Exception $e)
		{
			// TODO: come up with a clever way of chaining exceptions
			ob_end_clean();
			throw $e;
		}

		ob_end_clean();
		return $contents;
	}
240438
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $idString = $originalContentObjectAttribute->attribute( "data_text" );
            $contentObjectAttribute->setAttribute( "data_text", $idString );
            $contentObjectAttribute->store();
        }
    }
28785
protected function _renderTag($attribs = array(), $content = null)
    {
        if($this->getTemplate()->decorator() == 'joomla')
        {
            if($this->getConfig()->escape) {
                $content = $this->getTemplate()->escape($content);
            }

            JFactory::getDocument()->setTitle($content);
        }
        else return parent::_renderTag($attribs, $content);
    }
35196
public function addTemplateVariablesFor($template, array $contentVariables)
    {
        if (!array_key_exists($template, $this->paramArrays)) {
            $this->paramArrays[$template] = $this->getParamArrayFor($template);
        }

        // add vars for main template
        $contentVariables = array_merge($this->paramArrays[$template], $contentVariables);

        // add the template-variables to the contentItem-params-arrays
        if (array_key_exists(self::CONTENT_ITEMS, $contentVariables)) {
            foreach ($contentVariables[self::CONTENT_ITEMS] as $key => $contentItem) {
                // get the key (=> template)
                reset($contentItem);
                $itemTemplate = key($contentItem);

                // get the params
                $itemParams = $contentItem[$itemTemplate];

                // add params for this template
                $contentItem[$itemTemplate] = $this->addTemplateVariablesFor($itemTemplate, $itemParams);

                // store back into the main array
                $contentVariables[self::CONTENT_ITEMS][$key] = $contentItem;
            }
        }

        return $contentVariables;
    }
543638
public function setTemplate($template)
    {
        $this->templatePath = $this->getTemplatesDirectory() . '/' . ltrim($template, '/');
        if (!file_exists($this->templatePath)) {
            throw new \RuntimeException('View cannot render template `' . $this->templatePath . '`. Template does not exist.');
        }
    }