Skip to content

Commit

Permalink
#4148 - Build-in API support (tuning)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Oct 27, 2023
1 parent 8b79bf9 commit fa57672
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/boonex/forum/classes/BxForumModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function decodeDataApi ($aData, $bExtended = false)
if(!$oCategory)
return false;

$aResult['category'] = $oCategory->getCategoryTitle($aData[$CNF['FIELD_CATEGORY']]);
$aCategoryData = $this->_oDb->getCategories(['type' => 'by_category', 'category' => $aData[$CNF['FIELD_CATEGORY']]]);

$aResult['category'] = ['name' => $oCategory->getCategoryTitle($aData[$CNF['FIELD_CATEGORY']]), 'icon' => $aCategoryData['icon']];

return $aResult;
}
Expand Down
4 changes: 3 additions & 1 deletion template/scripts/BxBaseCmtsServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public function serviceGetAuthorBlock()
return [bx_api_get_block('entity_author', [
'author_data' => BxDolProfile::getData($aCmt['cmt_author_id']),
'entry_date' => $aCmt['cmt_time'],
'menu_manage' => []
'menu_manage' => [],
'text' => bx_process_output(strip_tags($oCmts->getObjectTitle($iObjectId))),
'url' => bx_api_get_relative_url($oCmts->getBaseUrl())
])];
}
}
Expand Down
12 changes: 12 additions & 0 deletions template/scripts/BxBasePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,10 @@ protected function _setSubmenu ($aParams)
*/
protected function _getBlockRaw ($aBlock)
{
if (bx_is_api()){
return [bx_api_get_block('raw', ['title' => _t($aBlock['title']), 'content' => BxDolTemplate::getInstance()->parseHtmlByContent($aBlock['content'], array())])];
}

$s = '<div class="bx-page-raw-container">' . BxDolTemplate::getInstance()->parseHtmlByContent($aBlock['content'], array()) . '</div>';
$s = $this->_replaceMarkers($s, array('block_id' => $aBlock['id']));
$s = bx_process_macros($s);
Expand All @@ -871,6 +875,10 @@ protected function _getBlockRaw ($aBlock)
*/
protected function _getBlockCustom ($aBlock)
{
if (bx_is_api()){
return [bx_api_get_block('custom', ['title' => _t($aBlock['title']), 'content' => BxDolTemplate::getInstance()->parseHtmlByContent($aBlock['content'], array())])];
}

$s = '<div class="bx-page-custom-container">' . BxDolTemplate::getInstance()->parseHtmlByContent($aBlock['content'], array()) . '</div>';
$s = $this->_replaceMarkers($s, array('block_id' => $aBlock['id']));
$s = bx_process_macros($s);
Expand All @@ -883,6 +891,10 @@ protected function _getBlockCustom ($aBlock)
*/
protected function _getBlockHtml ($aBlock)
{
if (bx_is_api()){
return [bx_api_get_block('html', ['title' => _t($aBlock['title']), 'content' => $aBlock['content']])];
}

$s = '<div class="bx-page-html-container bx-def-vanilla-html max-w-none">' . $aBlock['content'] . '</div>';
$s = $this->_replaceMarkers($s, array('block_id' => $aBlock['id']));
$s = bx_process_macros($s);
Expand Down

0 comments on commit fa57672

Please sign in to comment.