PHP code example of heimrichhannot / contao-multilingual-fields-bundle

1. Go to this page and download the library: Download heimrichhannot/contao-multilingual-fields-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heimrichhannot / contao-multilingual-fields-bundle example snippets


// ...
[
    // the original position field is nearly unchanged -> only some meta field links are set in eval
    'position' => [
        'exclude'   => true,
        'search'    => true,
        'inputType' => 'text',
        'eval'      => [
            'maxlength' => 128,
            'tl_class' => 'w50',
            'mandatory' => true,
            'isTranslatedField' => true,
            'translationConfig' => [
                'en' => [
                    'field' => 'en_position',
                    'selector' => 'en_translate_position'
]               ]
            ]
         ],
        'sql'       => "varchar(128) NOT NULL default ''"
    ],
    // automatically created: the selector field and the translation field
    // the selector field (subpalette and selector is also set)
    'en_translate_position' => [
        'label'     => ['Translate (English)', 'Click this option in order to translate the field for the given language.'],
        'exclude'   => true,
        'inputType' => 'checkbox',
        'eval'      => [
            'tl_class' => 'w50',
            'submitOnChange' => true,
            'translationField' => 'en_position',
            'translatedField' => 'position'
        ],
        'sql'       => "char(1) NOT NULL default ''",
    ],
    // the translation field
    'en_position' => [
        'label'     => ['Position (English)', '<the description as given>'], // generated automatically out of the label of the "position" field
        'exclude'   => true,
        'search'    => true,
        'inputType' => 'text',
        'eval'      => [
            'maxlength' => 128,
            'tl_class' => 'w50',
            'mandatory' => true,
            'translatedField' => 'position',
            'translationSelectorField' => 'en_translate_position'
         ],
        'sql'       => "varchar(128) NOT NULL default ''"
    ]
]