渲染模板

@param string $name
@param array  $context
@return string
518179
public function render($name, array $context = [])
    {
        $template = $this->environment->loadTemplate($name);
        return $template->render($context);
    }
1362665
static function setContextCache( $contextName, $context )
    {
        if ( $context === null )
        {
            return;
        }
        if ( isset( $GLOBALS['eZTranslationCacheTable'][$contextName] ) )
        {
            eZDebug::writeWarning( "Translation cache for context '$contextName' already exists", __METHOD__ );
        }
        else
        {
            $GLOBALS['eZTranslationCacheTable'][$contextName] = array();
        }
        $GLOBALS['eZTranslationCacheTable'][$contextName]['root'] = $context;
        $GLOBALS['eZTranslationCacheTable'][$contextName]['info'] = array( 'context' => $contextName );
    }
963172
public function renderBlock($name, array $context, array $blocks = [], $useBlocks = true)
    {
        return $this->template->renderBlock($name, $context, $blocks, $useBlocks);
    }
711152
protected function evalAttribute(Context $context, $name) {
		$expression = $this->getAttribute($name, false);
		if($expression) {
			return $this->evaluate($context, $expression);
		}
		return false;
	}
329123
public static function string($name)
    {
        $buffer = [];
        foreach (self::trigger($name) as $hook) {
            $buffer[] = $hook->output;
        }
        
        return implode("", $buffer);
    }
1194871
public function setAttr(array $name, array &$context, $value): self
    {
        $current = array_shift($name);

        if (count($name) === 0) {
            $this->setValueToContext($current, $context, $value);
            return $this;
        }

        if (!array_key_exists($current, $context) || !is_array($context[$current])) {
            $context[$current] = [];
        }

        $this->setAttr($name, $context[$current], $value);

        return $this;
    }
1204317
protected function findContext($context_name = 'default')
    {
        $user = $this->getSecurityManager()->findAuthenticatedUser();

        $context = $this->findContextByUser($context_name, $user);

        return $context;
    }
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;
        }
    }
711565
public function listen($name, $fn, $context = array())
    {
        $event = new Event($name, $fn, $context);
        if (!isset($this->handlers[$name])) {
            $this->handlers[$name] = array();
        }
        $this->handlers[$name][] = $event;// array('fn' => $fn, 'context' => $context);
        return $event;
    }
1333422
public function getText(string $name)
    {
        return $this->textContentAreas->where(function (TextContentArea $contentArea) use ($name) {
            return $contentArea->name === $name;
        })->first();
    }
1229801
public static function encode($data, array $context = [])
    {
        $context = array_merge(static::$defaultEncodeContext, $context);

        return static::encodeData($data, $context);
    }
230887
public function execute($name, AnCommandContext $context)
    {
        $parts = explode('.', $name);
        $result = $context->result;

        //after an action save
        if ($parts[0] === 'after' && $parts[1] != 'cancel') {

            //skip if there are not any commitable
            if (count($this->getRepository()->getSpace()->getCommitables()) == 0) {
                return;
            }

            $result = $this->commit();

            $type = $result === false ? 'error' : 'success';
            $message = $this->_makeStatusMessage($context->action, $type);

            if ($message) {
                $this->setMessage($message, $type);
            }

            if ($result === false) {
                if ($this->isIdentifiable() && $this->getItem()) {
                    if ($this->getItem()->getErrors()->count()) {
                        throw new AnErrorException($this->getItem()->getErrors(), AnHttpResponse::BAD_REQUEST);
                        return;
                    }
                } else {
                    $errors = AnHelperArray::getValues($this->getCommitErrors());
                    throw new AnErrorException($errors, AnHttpResponse::BAD_REQUEST);
                    return;
                }
            }
        }
    }
1143796
public function getSourceContext($name): Source
    {
        $code = $this->getSource($name);
        $path = $this->getFilename($name);

        return new Source($code, $name, $path);
    }
986120
public function render($context = [])
    {
        $element = clone $this->element;

        $value = $this->element->getAttribute('value', false);
        if ($value !== false) {
            $this->element->getAttributes()->remove('value');
        }
        $html = parent::render($context);
        $this->element = $element;
        return $html;
    }
382001
public static function resolve($classname, array $context)
    {
        if ($classname[0] === '\\') {
            return substr($classname, 1);
        }
        $cn = explode(':', $classname, 2);
        if (count($cn) === 1) {
            if (!empty($context['namespace'])) {
                $classname = $context['namespace'].$classname;
            }
            return $classname;
        }
        $module = $cn[0];
        $cn = $cn[1];
        if (!empty($context['modules'])) {
            $modules = $context['modules'];
            if (isset($modules[$module])) {
                return $modules[$module].'\\'.$cn;
            }
        }
        if (!empty($context['moduleResolver'])) {
            $cn = Callback::call($context['moduleResolver'], [$module, $cn]);
            if (is_string($cn)) {
                return $cn;
            }
        }
        throw new InvalidPointer($classname);
    }
275594
public function extract(array $context)
    {
        $params = [];

        foreach ($this->fields as $field) {
            if (isset($context[$field])) {
                $params[$field] = $context[$field];
                unset($context[$field]);
            }
        }

        if (!empty($context)) {
            $params['context'] = $context;
        }

        return $params;
    }
296540
public function getValue($context, $name, $default = null)
    {
        $all = $this->getAll($context);

        if (array_key_exists($name, $all)) {
            return $all[$name];
        }

        return $default;
    }