Skip to content

Commit

Permalink
#4148 - Build-in API support: Context in Timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Nov 8, 2023
1 parent 475c2a3 commit 3faaaf5
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions modules/boonex/timeline/classes/BxTimelineTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,8 @@ public function _getPostApi(&$aEvent, $aParams = [], $aEventAdd = [])
$aEvent['menu_manage'] = $oMenuManage->getCodeAPI();
}

$aEvent['owners'] = $this->_getTmplVarsTimelineOwner($aEvent);

$aCmts = [];
$oCmts = $oModule->getCmtsObject($aEvent['comments']['system'], $aEvent['comments']['object_id']);
if($oCmts !== false) {
Expand Down Expand Up @@ -2250,24 +2252,32 @@ protected function _getTmplVarsTimelineOwner(&$aEvent)
'icon' => 'check'
);
}

$aTmplVarsOwners[] = array(
'style_prefix' => $sStylePrefix,
'owner_type' => _t('_' . $sToType),
'owner_url' => $sToUrl,
'owner_username' => $sToName,
'bx_if:show_timeline_owner_actions' => array(
'condition' => !empty($aTmplVarsActions),
'content' => array(
'style_prefix' => $sStylePrefix,
'bx_repeat:timeline_owner_actions' => $aTmplVarsActions
if(bx_is_api()) {
$aTmplVarsOwners[] = $oOwner->getUnitAPI(0, ['template' => 'unit_wo_info']);
}
else{
$aTmplVarsOwners[] = array(
'style_prefix' => $sStylePrefix,
'owner_type' => _t('_' . $sToType),
'owner_url' => $sToUrl,
'owner_username' => $sToName,
'bx_if:show_timeline_owner_actions' => array(
'condition' => !empty($aTmplVarsActions),
'content' => array(
'style_prefix' => $sStylePrefix,
'bx_repeat:timeline_owner_actions' => $aTmplVarsActions
)
)
)
);
);
}
}

if(empty($aTmplVarsOwners))
return array();

if(bx_is_api()) {
return ($aTmplVarsOwners);
}

return array(
'style_prefix' => $sStylePrefix,
Expand Down

0 comments on commit 3faaaf5

Please sign in to comment.