/**
  * Adds a ExtJS module (main or sub) to the backend interface
  * FOR USE IN ext_tables.php FILES
  *
  * @static
  * @param string $extensionName
  * @param string $mainModuleName Is the main module key
  * @param string $subModuleName Is the submodule key, if blank a plain main module is generated
  * @param string $position Passed to \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule, see reference there
  * @param array $moduleConfiguration Icon with array keys: access, icon, labels to configure the module
  * @throws \InvalidArgumentException
  */
 public static function addExtJSModule($extensionName, $mainModuleName, $subModuleName = '', $position = '', array $moduleConfiguration = array())
 {
     if (empty($extensionName)) {
         throw new \InvalidArgumentException('The extension name must not be empty', 1325938973);
     }
     $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
     $extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName)));
     $defaultModuleConfiguration = array('access' => 'admin', 'icon' => 'gfx/typo3.png', 'labels' => '', 'extRelPath' => self::extRelPath($extensionKey) . 'Classes/');
     // Add mandatory parameter to use new pagetree
     if ($mainModuleName === 'web') {
         $defaultModuleConfiguration['navigationComponentId'] = 'typo3-pagetree';
     }
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultModuleConfiguration, $moduleConfiguration);
     $moduleConfiguration = $defaultModuleConfiguration;
     if (strlen($subModuleName) > 0) {
         $moduleSignature = $mainModuleName . '_' . $subModuleName;
     } else {
         $moduleSignature = $mainModuleName;
     }
     $moduleConfiguration['name'] = $moduleSignature;
     $moduleConfiguration['script'] = 'extjspaneldummy.html';
     $moduleConfiguration['extensionName'] = $extensionName;
     $moduleConfiguration['configureModuleFunction'] = array('TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility', 'configureModule');
     $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature] = $moduleConfiguration;
     self::addModule($mainModuleName, $subModuleName, $position);
 }