Beispiel #1
0
 public static function getListingDisplayParams($listing_id)
 {
     if (!$listing_id) {
         return null;
     }
     $storeId = md5(__METHOD__ . "::{$listing_id}");
     if (!isset(self::$cache[$storeId])) {
         $params = JUDirectoryHelper::getParams(null, $listing_id);
         $global_display_params = $params->get('display_params');
         $global_listing_display_object = isset($global_display_params->listing) ? $global_display_params->listing : array();
         $global_listing_display_params = new JRegistry($global_listing_display_object);
         $listingObj = JUDirectoryHelper::getListingById($listing_id);
         $listing_params = $listingObj->params;
         if ($listing_params) {
             $listing_params = json_decode($listing_params);
             $listing_display_params = $listing_params->display_params;
             if ($listing_display_params) {
                 $global_listing_display_params = JUDirectoryFrontHelperField::mergeFieldOptions($global_listing_display_params->toObject(), $listing_display_params);
                 unset($listing_display_params->fields);
                 foreach ($listing_display_params as $option => $value) {
                     if ($value == '-2') {
                         unset($listing_display_params->{$option});
                     }
                 }
                 $global_listing_display_params->loadObject($listing_display_params);
             }
         }
         self::$cache[$storeId] = $global_listing_display_params;
     }
     return self::$cache[$storeId];
 }