Render an icon.

@param Environment $twigEnvironment The twig environment.
@param string $name The name.
@param string|null $style The style.
@return string Returns the rendered icon.
168785
public static function renderIcon(Environment $twigEnvironment, $name, $style = null) {

        $handler = explode(":", $name);
        if (2 !== count($handler)) {
            return "";
        }

        $output = "";

        switch ($handler[0]) {

            case "fa": // Font Awesome
                $output = (new FontAwesomeTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;

            case "mc": // Meteocons
                $output = (new MeteoconsTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;

            case "zmdi": // Material Design Iconic Font
                $output = (new MaterialDesignIconicFontTwigExtension($twigEnvironment))->renderIcon($handler[1], $style);
                break;
        }

        return $output;
    }
767985
public function getEnvironment($name)
    {
        return isset($this->environments[$name]) ? $this->environments[$name] : null;
    }
9775
private function getTwigEnvironment()
    {
        if (null == $this->twigEnvironment) {
            $this->twigEnvironment = $this->createTwigEnvironment();
        }
        return $this->twigEnvironment;
    }
1075102
public function weather(\Twig_Environment $environment, $city)
    {
        $weathers = $this->weatherFactory->getWeatherObject($city);

        return $environment->render('PianoSoloWeatherBundle:Weather:weather.html.twig', array(
            'city' => $city,
            'weathers' => $weathers,
            'downloadEnabled' => $this->downloadEnabled
        ));
    }
253655
public function renderNodeTreeFunction(\Twig_Environment $twig, NodeInterface $node, array $options=array())
    {
        return $twig->render('MMCmfContentBundle:Form/NodeTree:list.html.twig', array('node' => $node, 'icon' => $this->getIcon(get_class($node)), 'options' => $options));
    }
1328567
public function evaluateTwigFunc($context, $twig ) {

        $loader = new \Twig_Loader_Filesystem('.');
        $env = new \Twig_Environment($loader);

        $template = $env->createTemplate($twig);

        return $template->render($context);
    }
692148
public function getTwig(): \Twig_Environment
    {
        if (is_null($this->twig)) {
            // Init Twig
            $this->twigLoader = new \Twig_Loader_Filesystem();
            $this->twig = new \Twig_Environment($this->twigLoader);
        }

        return $this->twig;
    }
764736
public function render($name, array $stylesheets, array $attributes = [], $newLine = true)
    {
        $formatter = $this->getFormatter();

        $tagStylesheets = [];
        foreach ($stylesheets as $stylesheet => $value) {
            $tagStylesheets[] = $this->stylesheetRenderer->render($stylesheet, $value);
        }

        return $this->getTagRenderer()->render(
            'style',
            $formatter->renderLines([
                $name.$formatter->renderSeparator().'{',
                $formatter->renderIndentation($formatter->renderLines($tagStylesheets, true, false)),
                '}',
            ], !empty($tagStylesheets), false),
            array_merge(['type' => 'test/css'], $attributes),
            $newLine
        );
    }
602465
public function renderMenu(\Twig_Environment $environment, $menuIdentifier, $depth = 1)
    {
        $queryBuilder = $this->repo->getNodesHierarchyQueryBuilder(null, false, array(), true)
            ->join('ClasticMenuBundle:Menu', 'menu', Join::WITH, 'menu.id = node.menu')
            ->andWhere('menu.identifier = :identifier')
            ->setParameter('identifier', $menuIdentifier);

        $globals = $environment->getGlobals();

        /** @var GlobalVariables $variables */
        $variables = $globals['app'];
        $currentUrl = $variables->getRequest()->server->get('REQUEST_URI');

        $items = array_map(function (MenuItem $item) use ($currentUrl) {

            $url = $item->getUrl();
            $node = $item->getNode();
            // TODO Remove getTitle once a solution is found.
            if ($node && $node->getTitle() && isset($node->alias)) {
                $url = '/'.$node->alias->getAlias();
            }

            return array(
                'title' => $item->getTitle(),
                'left' => $item->getLeft(),
                'right' => $item->getRight(),
                'root' => $item->getRoot(),
                'level' => $item->getLevel(),
                'id' => $item->getId(),
                '_node' => $item,
                '_active' => ($url == $currentUrl),
                '_link' => $url,
            );
        }, $queryBuilder->getQuery()->getResult());

        return $environment->render('ClasticMenuBundle:Twig:menu.html.twig', array(
            'tree' => $this->repo->buildTree($items),
        ));
    }
1025887
public function renderGluggiComponent (string $type, string $name, array $context = []) : string
    {
        $component = $this->finder->findComponent($type, $name);

        if (null === $component)
        {
            throw new UnknownComponentException($name, $type);
        }

        $context = array_replace([
            "standalone" => false,
        ], $context);

        return $this->container->get("twig")->render($component->getImportPath(), $context);
    }
612205
public function renderGrid(\Twig_Environment $environment, $context, $id, array $options = [])
    {
        $options = $this->resolver->resolve($options);

        $page = isset($context['page']) ? $context['page'] : null;

        if ($page instanceof AbstractPage) {
            $grid = $page->getGrid($id);

            if (!$grid instanceof Grid) {
                $grid = new Grid($id);
            }

            return $environment->render($options['template'], [
                'grid' => $grid,
            ]);
        }

        return '';
    }
210398
public function renderTable(\Twig_Environment $env, $args = array()) {
        $array = array();
        $config = $this->fillModel($array);
        $array['deleteUrl'] = $this->fetchUrl($args, 'delete', $config->getDeleteRoute());
        $array['tableId'] = $config->getId();
        $array['transScope'] = $config->getTransScope();
        $array['views'] = $config->getViews();
        $array['frontendFramework'] = $config->getFrontendFramework();
        $array['frontendFrameworkName'] = FrontendFramework::toString($config->getFrontendFramework());
        return $this->render($env, 'twentystepsAutoTablesBundle:AutoTablesExtension:autoTable.html.twig', $array);
    }
695254
public function renderPageTemplate(\Twig_Environment $env, array $twigContext, HasPageTemplateInterface $page, array $parameters = array())
    {
        $pageTemplates = $this->templateConfiguration->getPageTemplates($page);

        $pageTemplate = $pageTemplates[$this->getPageTemplate($page)];

        $template = $env->loadTemplate($pageTemplate->getTemplate());

        return $template->render(array_merge($parameters, $twigContext));
    }
142898
public function render(string $name, array $context = []): string
    {
        return $this->getTwig()->render($name, $context);
    }
941840
public function renderTwig(\Twig_Environment $environment, $template, array $parameters = array())
    {
        $template = $this->loadStringTemplate($environment, $template);

        return $template->render($parameters);
    }
839942
def render(self, template_name, **kw):
        ''
        return self.env.get_template(template_name).render(**kw)
383550
public function render(ResponseInterface $response, $name, array $context = [])
    {
        $file = $this->getFilename($name);

        $twig = $this->getTwig();
        $tmpl = $twig->load($file);
        
        $this->invokePluginsOnRender($file, $context);

        $contents = $tmpl->render($context);
        
        $newResponse = $response->withHeader('Content-Type', 'text/html; charset=' . $twig->getCharset());
        $newResponse->getBody()->write($contents);
        
        return $newResponse;
    }