我已将Formatter(使用CKeditor)插入我的一个Sonata的'content'
课程中的Admin
字段。此'content'
也有一个翻译,可通过'a2lix_translations_gedmo'
翻译类型进行编辑。我一直在尝试将CKeditor添加到此字段中,但它会在我尝试设置的任何配置中抛出异常。
谷歌和SO一无所知。我还查看了Sonata News Bundle个来源(其中sonata_formatter_type
已实施),但没有可用的翻译。
我的格式化程序字段:
->add('content', 'sonata_formatter_type', [
'label' => "Content",
'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(),
'format_field' => 'contentFormatter',
'source_field' => 'rawContent',
'ckeditor_context' => 'my_config',
'source_field_options' => [
'attr' => [
'class' => 'span10', 'rows' => 10
]
],
'listener' => TRUE,
'target_field' => 'content'
])
我的翻译字段:
->add('translations', 'a2lix_translations_gedmo', [
'label' => "Управление локализациями",
'translatable_class' => 'AppBundle\Entity\Article',
'fields' => [
'content' => [
'locale_options' => [
'ru' => [
'label' => 'Контент'
]
]
]
]
])
也许有人知道如何将'sonata_formatter_type'
添加到此死的'a2lix_translations_gedmo'
类型(或'a2lix_translations'
)?
答案 0 :(得分:2)
' a2lix_translations_gedmo'或者' a2lix_translations'取决于所选择的翻译策略。 不鼓励Gedmo策略,你应该使用像我推荐的KnpLabs这样的更新的翻译策略。 https://github.com/KnpLabs/DoctrineBehaviors#translatable
其他,请参阅https://github.com/a2lix/TranslationFormBundle/issues/177#issuecomment-94949480