PHP code example of oneup / contao-language-dependent-modules-bundle

1. Go to this page and download the library: Download oneup/contao-language-dependent-modules-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/ */

    

oneup / contao-language-dependent-modules-bundle example snippets



// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myLanguageDependentModules' => [
        'inputType' => 'languageDependentModulesSurrogate',
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];


// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myLanguageDependentModules' => [
        'inputType' => 'languageDependentModulesSurrogate',
        'options' => [
            0 => 'My module 0',
            1 => 'My module 1',
        ],
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];


// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myLanguageDependentModules' => [
        'inputType' => 'languageDependentModulesSurrogate',
        'options_callback' => ['my.service_id', 'methodName'],
        'eval' => [
            'tl_class' => 'w50',
        ],
        'sql' => 'blob NULL',
    ],
];

// you can also use this with service tagging, see https://docs.contao.org/dev/framework/dca/#registering-callbacks


// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myLanguageDependentModules' => [
        'inputType' => 'languageDependentModulesSurrogate',
        'eval' => [
            'tl_class' => 'w50',
            'modules' => [
                'navigation',
                'customnav',
                'search',
                'html',
                'myCustomModule',
            ],
        ],
        'sql' => 'blob NULL',
    ],
];


// config/dca/tl_modules.php

$GLOBALS['TL_DCA']['tl_module']['fields'] += [
    'myLanguageDependentModules' => [
        'inputType' => 'languageDependentModulesSurrogate',
        'eval' => [
            'tl_class' => 'w50',
            'blankOptionLabel' => 'My Label'
        ],
        'sql' => 'blob NULL',
    ],
];