Download the PHP package simettric/doctrine-translatable-form-bundle without Composer

On this page you can find all versions of the php package simettric/doctrine-translatable-form-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-translatable-form-bundle

DoctrineTranslatableFormBundle

The goal of this Symfony Bundle is simplify the creation of translatable forms using Gedmo Doctrine Extensions and StofDoctrineExtensionsBundle.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

Configuration

You must to activate the persist_default_translation key in your stof_doctrine_extensions configuration options

#app/config/config.yml
stof_doctrine_extensions:
    default_locale: %locale%
    translation_fallback: true
    persist_default_translation: true
    orm:
        default:
            translatable: true

Configure the view

This bundle implements the Bootstrap Tabs component in order to show the different locale inputs for each field.

If you want to use it, just add the template in the form_themes section in your Twig configuration. Obviously, the bootstrap assets must be loaded in your layout.

# app/config/config.yml
twig:
    ...
    form_themes:
        - 'SimettricDoctrineTranslatableFormBundle:Form:fields.html.twig'

Creating your forms

This is a simple example showing how you can code your translatable forms

Then you need to declare your form type as a service

#app/config/services.yml

parameters:
    locale: es
    locales: [es, eu, en, fr]

services:
    app.form.category_type:
        class: AppBundle\Form\CategoryType
        arguments: ["@sim_trans_form.mapper"]
        calls:
            - [ setRequiredLocale, [%locale%] ]
            - [ setLocales, [%locales%] ]
        tags:
            - { name: form.type }

And now you can work in your controller as if you worked with normal entities

$category = new Category();

$form = $this->createForm(CategoryType::class, $category);

if($request->getMethod() == "POST"){

    $form->handleRequest($request);

    if($form->isValid()){

        $em = $this->getDoctrine()->getManager();

        $em->persist($category);
        $em->flush();

    }
}

You can set your own Repository defining a new custom mapping service. This is useful for instance when you have a Personal Translation mapping configuration using a specific translation repository

services:
    app.my_custom_mapper:
        class:     Simettric\DoctrineTranslatableFormBundle\Form\DataMapper
        arguments: ["@doctrine.orm.entity_manager", "AppBundle\Repository\PostTranslationRepository"]

    app.form.post_type:
        class: AppBundle\Form\PostType
        arguments: ["@app.my_custom_mapper"]
        calls:
            - [ setRequiredLocale, [%locale%] ]
            - [ setLocales, [%locales%] ]
        tags:
            - { name: form.type }

If you have configured the Bootstrap Tabs theme in your Twig configuration, you can show your fields with the Boo in the templates with the form_row tag

<div class="form-group">
    {{ form_row(form.name, {label: "name"|trans}) }}
</div>

<div class="form-group">
    {{ form_row(form.description, {label: "description"|trans}) }}
</div>

All versions of doctrine-translatable-form-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/symfony Version ~2.8|~3.1
stof/doctrine-extensions-bundle Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package simettric/doctrine-translatable-form-bundle contains the following files

Loading the files please wait ....