定制 uerka/translation-form-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

uerka/translation-form-bundle

Composer 安装命令:

composer require uerka/translation-form-bundle

包简介

Provides widget to manage entity's translations

README 文档

README

Simplified version of https://github.com/a2lix/TranslationFormBundle. Supports only https://github.com/KnpLabs/DoctrineBehaviors. Supports symfony4

##Installation

composer require uerka/translation-form-bundle

Add to bundles:

Symfony4 - bundles.php

return [
    ...
    Uerka\TranslationFormBundle\UerkaTranslationFormBundle::class => ['all' => true],

Symfony3 - AppKernel.php

public function registerBundles()
{
    $bundles = [
    ...
    new Uerka\TranslationFormBundle\UerkaTranslationFormBundle(),
}

Configuration

uerka_translation_form: 
    locales: ["ru", "en"]

Add theme to twig settings:

twig:
    ...
    form_themes: 
        ...
        - '@UerkaTranslationForm/form/fields.html.twig'

Using form

...
use Uerka\TranslationFormBundle\Form\Type\TranslationsType;

class ExampleFormType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('translations', TranslationsType::class, [
                'locales' => ['ru', 'en', 'fr'], // optional, defaults to bundle's config
                'required_locales' => ['en'], // optional, defaults to bundle's config (equals to locale option)
                'fields' => [
                    'name' => [
                        'widget_class' => TextType::class, // optional, default TextType::class
                        'options' => [ // will be passed to field's options
                            'label' => 'form.label.name',
                        ],
                    ],
                    'shortDescription' => [
                        'widget_class' => TextareaType::class,
                        'options' => [
                            'label' => 'form.label.short_description',
                            'required' => false,
                        ]
                    ],
                ],
            ]);
            ...
       }
    ...
}

统计信息

  • 总下载量: 429
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固