From 49fc235c53907c85ad13cad5fe2ef34d5903178f Mon Sep 17 00:00:00 2001 From: "roman.lesnikov@gmail.com" Date: Tue, 7 Nov 2023 12:49:48 +0200 Subject: [PATCH] #4148 - Build-in API support (ads + small changes) --- modules/base/profile/classes/BxBaseModProfileModule.php | 4 ++-- modules/boonex/ads/classes/BxAdsFormsEntryHelper.php | 8 +++++--- modules/boonex/ads/classes/BxAdsModule.php | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/base/profile/classes/BxBaseModProfileModule.php b/modules/base/profile/classes/BxBaseModProfileModule.php index d42fb4e5a6..a551875d9e 100644 --- a/modules/base/profile/classes/BxBaseModProfileModule.php +++ b/modules/base/profile/classes/BxBaseModProfileModule.php @@ -2101,8 +2101,8 @@ public function decodeDataAPI($aData, $aParams = []) if(getParam('sys_api_conn_in_prof_units') == 'on' && ($oProfile = BxDolProfile::getInstanceByContentAndType($aData[$CNF['FIELD_ID']], $sModule)) !== false) { $iProfileId = $oProfile->id(); - - if(($oConnection = BxDolConnection::getObjectInstance('sys_profiles_friends')) !== false) { + $aResult['title'] = $oProfile->getDisplayName(); + if(($oConnection = BxDolConnection::getObjectInstance('sys_profiles_friends')) !== false && isset($CNF['URI_VIEW_FRIENDS'])) { $aResult['friends_count'] = $oConnection->getConnectedContentCount($iProfileId, true); $aResult['friends_list'] = $oConnection->getConnectedListAPI($iProfileId, true, BX_CONNECTIONS_CONTENT_TYPE_CONTENT); if(isLogged()) { diff --git a/modules/boonex/ads/classes/BxAdsFormsEntryHelper.php b/modules/boonex/ads/classes/BxAdsFormsEntryHelper.php index a24e29df07..892339a2d0 100644 --- a/modules/boonex/ads/classes/BxAdsFormsEntryHelper.php +++ b/modules/boonex/ads/classes/BxAdsFormsEntryHelper.php @@ -48,9 +48,11 @@ public function viewDataEntry ($iContentId) $oForm->initChecker($aContentInfo); if(!empty($CNF['FIELD_TEXT']) && !$oForm->isInputVisible($CNF['FIELD_TEXT'])) - return ''; - - return $this->_oModule->_oTemplate->entryText($aContentInfo); + $s = ''; + else + $s = $this->_oModule->_oTemplate->entryText($aContentInfo); + + return bx_is_api() ? [bx_api_get_block('entity_text', $s)] : $s; } public function onDataAddAfter($iAccountId, $iContentId) diff --git a/modules/boonex/ads/classes/BxAdsModule.php b/modules/boonex/ads/classes/BxAdsModule.php index 095093b292..d0085be951 100644 --- a/modules/boonex/ads/classes/BxAdsModule.php +++ b/modules/boonex/ads/classes/BxAdsModule.php @@ -422,6 +422,10 @@ public function serviceEntityCreate ($sParams = false) $sParams['display'] = $sDisplay; } + + if (is_int($sParams)){ + $_GET['category'] = $sParams; + } return parent::serviceEntityCreate($sParams); }