dongyi7901 2014-10-15 02:07
浏览 15
已采纳

自定义SyliusFlowBundle渲染

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条回答 默认 最新

  • dongxian3574 2014-10-15 06:51
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题