Skip to content

Instantly share code, notes, and snippets.

@nostadt
Last active June 18, 2019 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nostadt/79b4035ba71e07491933507617d1383a to your computer and use it in GitHub Desktop.
Save nostadt/79b4035ba71e07491933507617d1383a to your computer and use it in GitHub Desktop.
Register Backend Module with Icon from FontAwesome (Tested with 8 LTS)
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
(function () {
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
// Icons from: https://fontawesome.com/v3.2.1/icons/
foreach (['shopping-cart', 'search'] as $icon) {
$iconRegistry->registerIcon(
'vendor-' . $icon,
\TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class,
[
'name' => $icon,
]
);
}
})();
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
(function () {
/**
* ######################################################################
*
* SETTINGS
*
* ######################################################################
*/
$vendor = 'Vendor';
$extKey = 'my_ext';
$moduleExtensionName = $vendor . '.' . $extKey;
$mainModuleName = 'myextmain';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
$mainModuleName,
'',
'',
'',
[
'name' => $mainModuleName,
'access' => 'user,group',
'iconIdentifier' => 'vendor-search',
'labels' => [
'll_ref' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang_mod_myextmain.xlf',
],
]
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment