<?php

defined('TYPO3_MODE') || die('Access denied');

if (!isset($GLOBALS['TBE_MODULES']['pageadmin'])) {
    $temp_TBE_MODULES = array();
    foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
        if ($key == 'file') {  
            $temp_TBE_MODULES[$key] = $val;
            $temp_TBE_MODULES['pageadmin'] = '';
            
        } else {
            $temp_TBE_MODULES[$key] = $val;
        }
    }
    $GLOBALS['TBE_MODULES'] = $temp_TBE_MODULES;

}

call_user_func(function () {
    // Domain model "Activepage"
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
        'tx_domain_model_activepage',
        'EXT:mrmbepages/Resources/Private/Language/locallang_csh_tx_mrmbepages_domain_model_activepage.xlf'
    );

  

   
   TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
        'Meramo.mrmbepages',
        'pageadmin',
        '',
        '',
        [],
        [
            'access' => 'user,group',
            'icon' => 'EXT:mrmbepages/Resources/Public/Icons/managetime.png',
            'labels' => 'LLL:EXT:mrmbepages/Resources/Private/Language/locallang_mod.xlf:mlang_tabs_tab'
        ]
    );

    TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
        'Meramo.mrmbepages',
        'pageadmin',
        'pagelisting',
        '',
        [
            'Dashboard' => 'index, filterForm',
            'Activepage' => 'filteredsearchForm'
        ],
        [
            'access' => 'user,group',
            'icon' => 'EXT:mrmbepages/Resources/Public/Icons/list.png',
            'labels' => 'LLL:EXT:mrmbepages/Resources/Private/Language/locallang_submod.xlf:mlang_tabs_tab'
        ]
    );
});

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('mrmbepages', 'Configuration/TypoScript', 'Meramo Backend Extension');
