PHP code example of marcosimbuerger / contao-data-container-extension

1. Go to this page and download the library: Download marcosimbuerger/contao-data-container-extension 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/ */

    

marcosimbuerger / contao-data-container-extension example snippets


$GLOBALS['TL_DCA']['tl_my_module'] = array
(
	// Config
	'config' => array
	(
		'dataContainer' => 'TableExtension',
		'onload_callback' => array
		(
			array('tl_my_module', 'myOnLoadMethod'),
        ),
        // ...
    ),
    // ...
);
  
   

$GLOBALS['TL_DCA']['tl_iso_product_collection']['config']['dataContainer'] = 'TableExtension';
$GLOBALS['TL_DCA']['tl_iso_product_collection']['config']['onload_callback'][] = array('tl_my_module, 'myOnLoadMethod');

// tl_my_module.php

public function myOnLoadMethod(DC_Table $dataContainer): void {
    $dataContainer->myDcMethod = function() {
        // do something
    };
}