src/Kunstmaan/PagePartBundle/Twig/Extension/PagePartAdminTwigExtension.php
public function renderWidget(\Twig_Environment $env, PagePartAdmin $ppAdmin, $form = null, array $parameters = [], $templateName = null)
    {
        if ($templateName === null) {
            $templateName = 'KunstmaanPagePartBundle:PagePartAdminTwigExtension:widget.html.twig';
        }

        $template = $env->loadTemplate($templateName);

        return $template->render(array_merge($parameters, [
            'pagepartadmin' => $ppAdmin,
            'page' => $ppAdmin->getPage(),
            'form' => $form,
            'extended' => $this->usesExtendedPagePartChooser,
        ]));
    }
public function renderWidget(\Twig_Environment $env, PagePartAdmin $ppAdmin, $form = null, array $parameters = [], $templateName = null)
    {
        if ($templateName === null) {
            $templateName = 'KunstmaanPagePartBundle:PagePartAdminTwigExtension:widget.html.twig';
        }

        $template = $env->loadTemplate($templateName);

        return $template->render(array_merge($parameters, [
            'pagepartadmin' => $ppAdmin,
            'page' => $ppAdmin->getPage(),
            'form' => $form,
            'extended' => $this->usesExtendedPagePartChooser,
        ]));
    }
public function renderWidget ( \ Twig_Environment $ env , PagePartAdmin $ ppAdmin , $ form = null , array $ parameters = [ ] , $ templateName = null ) { if ( $ templateName === null ) { $ templateName = 'KunstmaanPagePartBundle:PagePartAdminTwigExtension:widget.html.twig' ; } $ template = $ env -> loadTemplate ( $ templateName ) ; return $ template -> render ( array_merge ( $ parameters , [ 'pagepartadmin' => $ ppAdmin , 'page' => $ ppAdmin -> getPage ( ) , 'form' => $ form , 'extended' => $ this -> usesExtendedPagePartChooser , ] ) ) ; }
Renders the HTML for a given pagepart

Example usage in Twig:

{{ pagepartadmin_widget(ppAdmin) }}

You can pass options during the call:

{{ pagepartadmin_widget(ppAdmin, {'attr': {'class': 'foo'}}) }}

{{ pagepartadmin_widget(ppAdmin, {'separator': '+++++'}) }}

@param \Twig_Environment $env
@param PagePartAdmin     $ppAdmin      The pagepart admin to render
@param Form              $form         The form
@param array             $parameters   Additional variables passed to the template
@param string            $templateName

@return string The html markup
Renders the HTML for a given pagepart