Pimcore\ExtensionManager::getBrickConfigs PHP Method

getBrickConfigs() public static method

public static getBrickConfigs ( null $customPath = null ) : array | mixed
$customPath null
return array | mixed
    public static function getBrickConfigs($customPath = null)
    {
        $cacheKey = "brick_configs";
        if ($customPath) {
            $cacheKey .= "_" . crc32($customPath);
        }
        try {
            $configs = \Zend_Registry::get($cacheKey);
        } catch (\Exception $e) {
            $configs = [];
            foreach (self::getBrickDirectories($customPath) as $areaName => $path) {
                try {
                    $configs[$areaName] = new \Zend_Config_Xml($path . "/area.xml");
                } catch (\Exception $e) {
                    Logger::error("Unable to initalize brick with id: " . $areaName);
                    Logger::error($e);
                }
            }
            \Zend_Registry::set($cacheKey, $configs);
        }
        return $configs;
    }

Usage Example

Example #1
0
 /**
  * @param bool $arrayKeys
  *
  * @return array|mixed
  */
 private static function getActiveBricks($arrayKeys = TRUE)
 {
     $areaElements = ExtensionManager::getBrickConfigs();
     /**
      * @var String $areaElementName
      * @var \Zend_Config_Xml $areaElementData
      */
     foreach ($areaElements as $areaElementName => $areaElementData) {
         if (!ExtensionManager::isEnabled('brick', $areaElementName)) {
             unset($areaElements[$areaElementName]);
             continue;
         }
     }
     if ($arrayKeys === TRUE) {
         return array_keys($areaElements);
     }
     return $areaElements;
 }
All Usage Examples Of Pimcore\ExtensionManager::getBrickConfigs