Skip to content
Snippets Groups Projects
ext_localconf.php 3.55 KiB
<?php

if (!defined('TYPO3_MODE')) {
	die('Access denied.');
}

$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] .= ',tx_sgnews_teaser1_image,tx_sgnews_teaser2_image';

/** @noinspection PhpUndefinedVariableInspection */
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_news');

// common typoscript configuration
$tsPath = $extPath . 'Configuration/TypoScript/Common/';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(file_get_contents($tsPath . 'setup.txt'));

// plugin configurations
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'Overview',
	['Overview' => 'overview',],
	['Overview' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'ListByCategory',
	['ListByCategory' => 'index',],
	['ListByCategory' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'SingleView',
	['SingleView' => 'singleView',],
	['SingleView' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'NewsFeed',
	['NewsFeed' => 'index',],
	['NewsFeed' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'Latest',
	['Latest' => 'index',],
	['Latest' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'ListByCategory',
	['ListByCategory' => 'index',],
	['ListByCategory' => '',]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	'SGalinski.sg_news',
	'PageBrowser',
	['PageBrowser' => 'index',],
	['PageBrowser' => '',]
);

if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_ajax')) {
	\SGalinski\SgAjax\Service\AjaxRegistration::configureAjaxFrontendPlugin('sg_news', [
			'Ajax\Like' => 'addLike',
		]
	);
}

// hook registration
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] =
	'EXT:sg_news/Classes/TCA/TcaProvider.php:SGalinski\SgNews\TCA\TcaProvider';

// Xclasses
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\CMS\Core\Page\PageRenderer'] =
	['className' => 'SGalinski\SgNews\Xclass\PageRenderer'];

// add realurl configuration
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
	$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration']['sgnews'] =
		\SGalinski\SgNews\Hooks\RealUrlAutoConfiguration::class . '->addNewsConfig';
}

/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);

$signalSlotDispatcher->connect(
	\TYPO3\CMS\Backend\Controller\EditDocumentController::class,
	'preInitAfter',
	\SGalinski\SgNews\Hooks\EditDocumentController::class,
	'preInitAfter'
);

if(!is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'])) {
	$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'] = [];
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'][] =
	\SGalinski\SgNews\Hooks\PageLayoutController::class . '->addNewsModuleLink';


// register command controllers
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] =
	'SGalinski\SgNews\Command\MigrateNewsCommandController';


\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:sg_news/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig">'
);