forked from fnagel/generic-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathext_localconf.php
83 lines (73 loc) · 3.23 KB
/
ext_localconf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
use FelixNagel\GenericGallery\Utility\EmConfiguration;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use FelixNagel\GenericGallery\Controller\GalleryCollectionController;
use FelixNagel\GenericGallery\Controller\GalleryItemController;
use FelixNagel\GenericGallery\Routing\Aspect\ImageItemMapper;
use FelixNagel\GenericGallery\UpgradeWizard;
use TYPO3\CMS\Core\Resource\Collection\StaticFileCollection;
defined('TYPO3') || die();
call_user_func(function () {
$configuration = EmConfiguration::getSettings();
// BE preview
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['genericgallery_pi1'][] =
'FelixNagel\GenericGallery\Backend\Hooks\PageLayoutViewHook->getExtensionSummary';
// Add page TS config
ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:generic_gallery/Configuration/TSconfig/page.tsconfig">'
);
if (!$configuration->isEnableTypeItems()) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'TCEFORM.tt_content.tx_generic_gallery_items.disabled = 1'
);
}
if (!$configuration->isEnableTypeImages()) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'TCEFORM.tt_content.tx_generic_gallery_images.disabled = 1'
);
}
if (!$configuration->isEnableTypeCollection()) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'TCEFORM.tt_content.tx_generic_gallery_collection.disabled = 1'
);
}
if ($configuration->isHideRelations()) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(trim('
mod.web_list.table.tx_generic_gallery_pictures.hideTable = 1
mod.web_list.table.tx_generic_gallery_content.hideTable = 1
'));
}
// FE plugin
ExtensionUtility::configurePlugin(
'GenericGallery',
'Pi1',
[
GalleryCollectionController::class => 'show',
GalleryItemController::class => 'show',
],
// non-cacheable actions
[
GalleryCollectionController::class => '',
GalleryItemController::class => '',
]
);
// Add cHash configuration
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['requireCacheHashPresenceParameters'] =
array_merge($GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['requireCacheHashPresenceParameters'], [
'tx_genericgallery_pi1[controller]',
'tx_genericgallery_pi1[action]',
'tx_genericgallery_pi1[item]',
'tx_genericgallery_pi1[contentElement]',
]);
// Routing
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['GenericGalleryImageItemMapper'] = ImageItemMapper::class;
// File collection
if ($configuration->getAddImageCollection()) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredCollections']['images'] =
StaticFileCollection::class;
}
// Upgrade wizards
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][UpgradeWizard\PluginListTypeWizard::class]
= UpgradeWizard\PluginListTypeWizard::class;
});