Customize SyliusFlowBundle render

人盡茶涼 提交于 2019-12-13 18:41:16

问题


I'm using Fuelux Wizard component for set up a wizard on my application. This is the HTML markup on my template:

<div class="wizard" data-initialize="wizard" id="myWizard">
    <ul class="steps">
        <li data-step="1" class="active"><span class="badge">1</span>Step 1<span class="chevron"></span></li>
        <li data-step="2"><span class="badge">2</span>Step 2<span class="chevron"></span></li>
        <li data-step="3"><span class="badge">3</span>Step 3<span class="chevron"></span></li>
    </ul>
    <div class="actions">
        <button class="btn btn-default btn-prev"><span class="glyphicon glyphicon-arrow-left"></span>Previous</button>
        <button class="btn btn-default btn-next" data-last="Complete">Next<span class="glyphicon glyphicon-arrow-right"></span></button>
    </div>
    <div class="step-content">
            <div class="step-pane active sample-pane" data-step="1">
                // here goes the firstStep
            </div>
            <div class="step-pane sample-pane " data-step="2">
                // here goes the secondStep
            </div>
            <div class="step-pane sample-pane" data-step="3">
                // here goes the thirdtStep
            </div>
    </div>
</div>

This is the displayAction method on ControllerStep:

public function displayAction(ProcessContextInterface $context)
{
    $entity = new Producto();
    $form = $this->createForm(new FirstStepFormType(), $entity);

    return $this->render('RPNIBundle:Producto:_paso1.html.twig', array(
                'entity' => $entity,
                'form' => $form->createView())
    );
}

How do I render the displayAction output where it should go? In this case where the text // here goes the firstStep is? How do I manage Previos/Next links in my template?


回答1:


What did you mean about rendering? It seems that you already did it in your code snippet. As for Previous/Next links there are methods $context->getPreviousStep() and $context->getNextStep(), so in template you can do

{{ path('sylius_flow_display', {'scenarioAlias': 'sylius_flow', 'stepName': context.previous}) }}



来源:https://stackoverflow.com/questions/26373355/customize-syliusflowbundle-render

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!