PHP code example of terminal42 / dcawizard

1. Go to this page and download the library: Download terminal42/dcawizard 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/ */

    

terminal42 / dcawizard example snippets


'prices' => [
    'inputType'    => 'dcaWizard',
    'foreignTable' => 'tl_iso_prices',
    'eval' => [
        'fields' => ['id', 'name', 'alias'],
    ],
],



use Composer\InstalledVersions;
use Contao\CoreBundle\DependencyInjection\Attribute\AsCallback;

#[AsCallback('tl_my_table', 'fields.my_field.attributes')]
class MyFieldAttributesListener
{
    public function __invoke(array $attributes): array
    {
        $isNewVersion = version_compare(InstalledVersions::getVersion('terminal42/dcawizard'), '4.0', '>=');

        $attributes['eval']['customTpl'] = $isNewVersion ? 'backend/widget/dcawizard_custom': 'be_widget_dcawizard_custom';

        return $attributes;
    }
}

'eval' => [
    'customTpl' => 'backend/widget/dcawizard_custom',
],

'prices' => [
    'inputType' => 'dcaWizard',

    // Define the foreign table
    'foreignTable' => 'tl_iso_prices',

    // Define the foreign field (e.g. fid instead of pid)
    'foreignField' => 'fid',

    // Use a callback to determine the foreign table dynamically
    'foreignTable_callback' => ['tl_iso_prices', 'getTableName'],

    // Add special params to the popup button link
    'params' => [
        'do'          => 'member',
        'filterField' => 'group',
    ],

    'eval' => [
        // Fields to display in the list columns
        'fields' => ['id', 'name', 'alias'],

        // Custom column headers (leave empty to use field labels)
        'headerFields' => ['ID', 'Name', 'Alias'],

        // Custom label for the edit/open button
        'editButtonLabel' => $GLOBALS['TL_LANG']['tl_iso_products']['prices_edit_button'],

        // Label shown when no records exist
        'emptyLabel' => $GLOBALS['TL_LANG']['tl_iso_products']['prices_empty_label'],

        // Order records by a specific field
        'orderField' => 'name DESC',

        // Hide the popup button (show list only)
        'hideButton' => true,

        // Show per-row operations
        'showOperations' => true,

        // Limit which operations appear per row
        'operations' => ['edit', 'delete', 'new'],

        // Add global operations above the list
        'global_operations' => ['new'],

        // Use a custom widget template
        'customTpl' => 'backend/widget/dcawizard_custom',
    ],
],

'inputType' => 'dcaWizardMultilingual',

'eval' => [
    'langColumn' => 'language_column_name',
],