自定义SyliusFlowBundle渲染

时间:2014-10-15 02:07:09

标签: php symfony symfony-forms sylius

我使用Fuelux Wizard组件在我的应用程序上设置向导。这是我模板上的HTML标记:

<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>

这是displayAction上的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())
    );
}

如何将displayAction输出呈现在应该去的位置?在这种情况下,文本// here goes the firstStep是?如何管理模板中的Previos/Next个链接?

1 个答案:

答案 0 :(得分:0)

你对渲染的意思是什么?您似乎已经在代码段中执行了此操作。至于上一个/下一个链接,有方法$context->getPreviousStep()$context->getNextStep(),所以在模板中你可以做

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