test fix to compensate for not truncating status anymore
[civicrm-core.git] / CRM / Extension / Mapper.php
index c70f218dad0f299ef5009fabed745b2d239d808f..e393d8ee7874ba49a2fe3fbd39c07d64b523e5a2 100755 (executable)
@@ -84,6 +84,13 @@ class CRM_Extension_Mapper {
 
   protected $civicrmUrl;
 
+  /**
+   * @param CRM_Extension_Container_Interface $container
+   * @param CRM_Utils_Cache_Interface $cache
+   * @param null $cacheKey
+   * @param null $civicrmPath
+   * @param null $civicrmUrl
+   */
   public function __construct(CRM_Extension_Container_Interface $container, CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $civicrmPath = NULL, $civicrmUrl = NULL) {
     $this->container = $container;
     $this->cache = $cache;
@@ -305,6 +312,29 @@ class CRM_Extension_Mapper {
     return $moduleExtensions;
   }
 
+  /**
+   * Get a list of base URLs for all active modules
+   *
+   * @return array (string $extKey => string $baseUrl)
+   */
+  public function getActiveModuleUrls() {
+    // TODO optimization/caching
+    $urls = array();
+    $urls['civicrm'] = $this->keyToUrl('civicrm');
+    foreach ($this->getModules() as $module) {
+      /** @var $module CRM_Core_Module */
+      if ($module->is_active) {
+        $urls[$module->name] = $this->keyToUrl($module->name);
+      }
+    }
+    return $urls;
+  }
+
+  /**
+   * @param $name
+   *
+   * @return bool
+   */
   public function isActiveModule($name) {
     $activeModules = $this->getActiveModuleFiles();
     foreach ($activeModules as $activeModule) {