Skip to content

Commit

Permalink
[TASK] Use controller classes for plugin/module setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrodala committed Jun 22, 2022
1 parent 1d0ce1d commit eadde0c
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 28 deletions.
84 changes: 66 additions & 18 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,75 @@
die('Access denied.');
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'Searchbar',
['Search' => 'searchbar'],
['Search' => 'searchbar']
);
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11', '>=')) {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Searchable',
'Searchbar',
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'searchbar',
],
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'searchbar',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Searchable',
'LiveSearchbar',
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'liveSearchbar',
],
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'liveSearchbar',
]
);


\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Searchable',
'Results',
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'results',
],
[
\PAGEmachine\Searchable\Controller\SearchController::class => 'results',
]
);
} else {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'Searchbar',
[
'Search' => 'searchbar',
],
[
'Search' => 'searchbar',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'LiveSearchbar',
['Search' => 'liveSearchbar'],
['Search' => 'liveSearchbar']
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'LiveSearchbar',
[
'Search' => 'liveSearchbar',
],
[
'Search' => 'liveSearchbar',
]
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'Results',
[
'Search' => 'results',
],
[
'Search' => 'results',
]
);
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'PAGEmachine.Searchable',
'Results',
['Search' => 'results'],
['Search' => 'results']
);

// Add custom logging
if (empty($GLOBALS['TYPO3_CONF_VARS']['LOG']['PAGEmachine']['Searchable']['writerConfiguration'])) {
Expand Down
34 changes: 24 additions & 10 deletions ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,34 @@
die('Access denied.');
}

// Backend module
if (TYPO3_MODE === 'BE') {
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11', '>=')) {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Searchable',
'web',
'searchable',
'',
[
\PAGEmachine\Searchable\Controller\BackendController::class => 'start, search, request, resetIndices, indexFull, indexPartial',
],
[
'access' => 'user,group',
'icon' => 'EXT:searchable/ext_icon.svg',
'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf',
]
);
} else {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'PAGEmachine.Searchable',
'web',
'searchable',
'',
array(
'Backend' => 'start, search, request, resetIndices, indexFull, indexPartial'
),
array(
'access' => 'user,group',
'icon' => 'EXT:searchable/ext_icon.svg',
'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf'
)
[
'Backend' => 'start, search, request, resetIndices, indexFull, indexPartial',
],
[
'access' => 'user,group',
'icon' => 'EXT:searchable/ext_icon.svg',
'labels' => 'LLL:EXT:searchable/Resources/Private/Language/locallang_mod.xlf',
]
);
}

0 comments on commit eadde0c

Please sign in to comment.