自定义 SyliusFlowBundle 渲染 [英] Customize SyliusFlowBundle render

查看:33
本文介绍了自定义 SyliusFlowBundle 渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<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><div class="actions"><button class="btn btn-default btn-prev"><span class="glyphicon glyphicon-arrow-left"></span>上一个</button><button class="btn btn-default btn-next" data-last="Complete">Next<span class="glyphicon glyphicon-arrow-right"></span></button>

<div class="step-content"><div class="step-pane active sample-pane" data-step="1">//这是第一步

<div class="step-pane sample-pane " data-step="2">//这里是第二步

<div class="step-pane sample-pane" data-step="3">//这里是第三步

这是ControllerStep上的displayAction方法:

public function displayAction(ProcessContextInterface $context){$entity = new Producto();$form = $this->createForm(new FirstStepFormType(), $entity);return $this->render('RPNIBundle:Producto:_paso1.html.twig', array('实体' =>$实体,'形式' =>$form->createView()));}

如何将 displayAction 输出呈现在它应该去的地方?在这种情况下,文本 //这里是 firstStep 是?如何管理模板中的 Previos/Next 链接?

解决方案

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

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

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?

解决方案

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

这篇关于自定义 SyliusFlowBundle 渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
PHP最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆