我们跟随这位讲师构建了一个自定义捆绑包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>
这是否有办法改变这些收音机以从数组中获取数据或从某些控制器操作中获取数据?或有另一种方法来使用具有树枝功能的树枝文件而不是 html 文件?
请为我们提供解决方案?谢谢
对不起我的英语不好。