<?php

use Opentalent\OtTemplating\Controller\OtCustomizerController;

defined('TYPO3') || die('Access denied.');

// ext_tables.php contient les directives permettant de configurer le backend

call_user_func(
    function()
    {
        // Include the configuration files
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
            'ot_templating',
            'Configuration/TypoScript',
            'Templating');

        if (TYPO3_MODE === 'BE') {
            /**
             * Registers the customizer backend module
             */
            \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
                'OtTemplating',
                'web', // Make module a submodule of 'web'
                'otcustomizer', // Submodule key
                'before:OtStatsOtstats', // Position
                array(
                    OtCustomizerController::class => 'index,selectTemplate,updatePreferences',
                ),
                array(
                    'access' => 'user,group',
                    'icon' => 'EXT:ot_templating/Resources/Public/Icons/Extension.png',
                    'labels' => 'LLL:EXT:ot_templating/Resources/Private/Language/locallang_mod.xlf',
                )
            );
        }
    }
);
