[英]Sonata Admin - A2LiX Translation Field + Sonata Formatter Type
我已经将Formatter (带有CKeditor)插入到Sonata的Admin
类之一的'content'
字段中。 此'content'
还具有翻译,可通过'a2lix_translations_gedmo'
翻译类型进行编辑。 我也一直试图将CKeditor添加到此字段,但是它在我尝试设置的任何配置中都会引发异常。
Google对此一无所知。 我还查看了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'
)中?
“ a2lix_translations_gedmo”或“ a2lix_translations”取决于所选的翻译策略。 不鼓励使用Gedmo策略,您应该使用更新的翻译策略,例如我建议的KnpLabs。 https://github.com/KnpLabs/DoctrineBehaviors#translatable
否则,请参见https://github.com/a2lix/TranslationFormBundle/issues/177#issuecomment-94949480
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.