PHP code example of t3g / usercentrics

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

    

t3g / usercentrics example snippets


    $dataProcessingService = 'My Data Processing Service';
    $identifier = \TYPO3\CMS\Core\Utility\StringUtility::getUniqueId($dataProcessingService . '-');
    $file = 'EXT:site/Resources/Public/JavaScript/Scripts.js';
    $attributes = [
        'type' => 'text/plain',
        'data-usercentrics' => $dataProcessingService
    ];
    $assetCollector = GeneralUtility::makeInstance(AssetCollector::class);
    $assetCollector->addJavaScript($identifier, $file, $attributes);