<?php
defined('TYPO3') || die();

\FluidTYPO3\Flux\Core::registerProviderExtensionKey('Wga.WgaFaq', 'Content');

$boot = static function (): void {
    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
        'WgaFaq',
        'Pi1',
        [
            \Wga\WgaFaq\Controller\FaqController::class => 'list,detail',
        ],
        [
            \Wga\WgaFaq\Controller\FaqController::class => 'list,detail',
        ]
    );
};

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
    @import \'EXT:wga_faq/Configuration/TSconfig/ContentElementWizard.tsconfig\'
    @import \'EXT:wga_faq/Configuration/TSconfig/TemplateLayouts.tsconfig\'
    ');
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon(
    'fce-faq',
    \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
    ['source' => 'EXT:wga_faq/Resources/Public/Icons/Content/fce-faq.svg']
);
$iconRegistry->registerIcon(
    'apps-pagetree-folder-contains-faq',
    \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
    ['source' => 'EXT:wga_faq/Resources/Public/Icons/ext-wgafaq-folder-tree.svg']
);

$boot();
unset($boot);

if(class_exists(Wga\WgaKeSearch\Indexer\Types\Faq::class)){
	$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerIndexerConfiguration'][] = Wga\WgaKeSearch\Indexer\Types\Faq::class;
	$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['customIndexer'][] = Wga\WgaKeSearch\Indexer\Types\Faq::class;
}
