【发布时间】:2019-11-14 18:25:47
【问题描述】:
我们构建了一个自定义捆绑包跟随这位讲师https://blog.sulu.io/how-to-develop-a-bundle-in-the-sulu-admin-1 我们需要知道如何从数据库传递数据以呈现单选输入选项或下拉选择。
我们尝试创建一个添加/编辑表单,在表单中,我们在 Vendor/TransportationBundle/Resources/public/js/components/transportation/form/form.html 的 HTML 文件中使用硬核制作了一个单选和下拉列表
代码是
<div class="grid-row">
<label for="transportation-transportationType"><%= translations.transportationType %></label>
<div class="custom-radio">
<input name="transportationType" id="transportation-transportationType-1" type="radio"
class="form-element content-type" value="1" data-mapper-property="transportationType">
<span class="icon"></span>
</div>
<span class="clickable"><%= translations.private_shuttle %></span>
<div class="custom-radio">
<input name="transportationType" id="transportation-transportationType-2" type="radio"
class="form-element content-type" value="2" data-mapper-property="transportationType">
<span class="icon"></span>
</div>
<span class="clickable"><%= translations.shared_shuttle %></span>
<div class="custom-radio">
<input name="transportationType" id="transportation-transportationType-3" type="radio"
class="form-element content-type" value="3" data-mapper-property="transportationType">
<span class="icon"></span>
</div>
<span class="clickable"><%= translations.airplane %></span>
</div>
这是否有办法改变这些收音机以从数组中获取数据或从某些控制器操作中获取数据?还是有另一种方法来使用具有 twig 功能的 twig 文件而不是 html 文件?
请为我们提供解决方案?谢谢
对不起我的英语。
【问题讨论】: