/**
  * Adds extension to extension list and returns new list. If -1 is returned, an error happend.
  * Checks dependencies etc.
  *
  * @param	string		Extension key
  * @param	array		Extension information array - information about installed extensions
  * @return	string		New list of installed extensions or -1 if error
  * @see showExtDetails()
  */
 function addExtToList($extKey, $instExtInfo)
 {
     global $TYPO3_LOADED_EXT;
     // ext_emconf.php information:
     $conf = $instExtInfo[$extKey]['EM_CONF'];
     // Get list of installed extensions and add this one.
     $listArr = array_keys($TYPO3_LOADED_EXT);
     if ($conf['priority'] == 'top') {
         array_unshift($listArr, $extKey);
     } else {
         $listArr[] = $extKey;
     }
     // Manage other circumstances:
     $listArr = tx_em_Tools::managesPriorities($listArr, $instExtInfo);
     $listArr = $this->removeRequiredExtFromListArr($listArr);
     // Implode unique list of extensions to load and return:
     $list = implode(',', array_unique($listArr));
     return $list;
 }