Ir al artículo

Controller Code - Github

    /**
     * @Route("/forms/virtual", name="examples_virtual_forms")
     * @Template("MainBundle:Example\VirtualForms:virtual_forms.html.twig")
     */
    public function formsVirtualAction()
    {
        return array();
    }

Template Code - Github

{% extends 'MainBundle::layout.html.twig' %}

{% import 'MainBundle:Macros:breadcrumb.html.twig' as breadcrumb %}

{% set section = 'examples' %}

{% block breadcrumb %}
{{ breadcrumb.show_example('Opción virtual en los formularios') }}
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-12">
            <ul class="list-group">
               <li class="list-group-item"><a href="{{ path('examples_virtual_forms_dog_create') }}">Crear Perro</a></li>
               <li class="list-group-item"><a href="{{ path('examples_virtual_forms_bird_create') }}">Crear Pájaro</a></li>
            </ul>
        </div>
    </div>
{% endblock %}


{% set article_link = 'http://showmethecode.es/php/symfony/symfony2-opcion-virtual-en-los-formularios/' %}

Fork me on GitHub