gpt4 book ai didi

symfony - 如何使用 Sonata_type_admin 将布局包含到 SonataAdminBundle 选项卡

转载 作者:行者123 更新时间:2023-12-01 05:03:08 24 4
gpt4 key购买 nike

我将 Symfony2 与 SonataAdminBundle 一起使用,但在添加带有 Sonata_type_admin 实体编辑的 Tab 时遇到了问题。如果我转到实体编辑页面 - 好的,但是如果我在选项卡布局上的 OneToOne 关系中添加字段,则未加载并且全部采用一种样式。

阅读文档对我没有帮助,我在设置中没有发现这个问题的决定。请帮我。

主要对象编辑

$formMapper
->tab('Основная информация')
->with('Данные клуба', ['class' => 'col-md-8'])
->add('name', 'text', array('label' => 'Название'))
->add('alias', 'text', array('label' => 'alias в url на сайте'))
->add('logo', 'text', ['label' => 'Логотип'])
->add('description', 'textarea', ['label' => 'Описание клуба'])
->end()
->with('Основные настройки', ['class' => 'col-md-4'])
->add('type', 'entity', [
'label' => 'Тип клуба',
'class' => 'PbmozgSiteBundle:ClubType',
'query_builder' => function(EntityRepository $repository) {return $repository->createQueryBuilder('ClubType')->orderBy('ClubType.id', 'ASC');},
'property' => 'name',
'empty_value' => 'Выберите тип клуба',
'required' => false
]
)
->add('enabled', 'checkbox', ['label' => 'Включен'])
->add('vip', 'checkbox', ['label' => 'VIP'])
->add('rating', 'text', [
'label' => 'Рейтинг клуба',
'read_only' => true,
'disabled' => true,
]
)
->end()
->end()
->tab('Контактная информация')
->with('Контакты')
->add('contacts', 'sonata_type_admin', ['required' => false, 'delete' => false, 'btn_add' => false])
->end()
->end();
;

Main object with sonata_type_admin

和带有添加数据的子对象
$formMapper
->with('Способы связи', ['class' => 'col-md-4'])
->add('phones', 'collection',
[
'label' => 'Телефоны',
'type' => new ClubPhonesListType(),
'required' => false,
'allow_add' => true,
'allow_delete' => true,
'attr' => ['class' => 'emails-list'],
'options' => ['label' => ' ', 'required' => false],
],
[
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
])
->add('emails', 'collection',
[
'label' => 'Электронная почта',
'type' => new ClubEmailsListType(),
'required' => false,
'allow_add' => true,
'allow_delete' => true,
'attr' => ['class' => 'emails-list'],
'options' => ['label' => ' ', 'required' => false],
],
[
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
])
->end()
->with('Геоданные', ['class' => 'col-md-4'])
->add('latitude', 'text', ['label' => 'Широта'])
->add('longitude', 'text', ['label' => 'Долгота'])
->add('polygon', 'text', ['label' => 'Полигон на карте'])
->add('country', 'text', ['label' => 'Город'])
->add('region', 'text', ['label' => 'Регион'])
->add('city', 'text', ['label' => 'Город'])
->add('address', 'text', ['label' => 'Полный адрес'])
->end()
->with('WEB', ['class' => 'col-md-4'])
->add('site', 'text', ['label' => 'Адрес сайта'])
->end()
;

View in singe edit

最佳答案

我也有同样的问题。我找到了这个 :

https://sonata-project.org/bundles/admin/master/doc/reference/action_create_edit.html#formgroup-options

第 8.2 节:

去做:

how to embed one Admin in another (1:1, 1:M, M:M)

所以,我认为目前没有解决方案? :/

关于symfony - 如何使用 Sonata_type_admin 将布局包含到 SonataAdminBundle 选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31300441/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com