Skip to content

Commit

Permalink
Ticket #4558 - Build-in API support: Spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Nov 14, 2024
1 parent e684117 commit c858628
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions modules/boonex/spaces/classes/BxSpacesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,24 @@ public function serviceEntityDelete ($iContentId = 0)
$iContentId = $this->_getContent($iContentId, false);
if($iContentId === false)
return false;

$iCount = $this->_oDb->getCountEntriesByParent($iContentId);
if ($iCount > 0)
return MsgBox(_t('_bx_spaces_err_delete_child_presend'));
return $this->_serviceEntityForm ('deleteDataForm', $iContentId);
if($iCount > 0 && ($sMsg = '_bx_spaces_err_delete_child_presend'))
return !$this->_bIsApi ? MsgBox(_t($sMsg)) : [bx_api_get_msg($sMsg)];

$mixedResult = $this->_serviceEntityForm ('deleteDataForm', $iContentId);
if(!$this->_bIsApi)
return $mixedResult;

$aResult = [];
if(is_a($mixedResult, 'BxTemplFormView'))
$aResult = bx_api_get_block('form', $mixedResult->getCodeAPI(), ['ext' => ['name' => $this->getName(), 'request' => ['url' => '/api.php?r=' . $this->_aModule['name'] . '/entity_delete&params[]=' . $iContentId . '&params[]=' . $mixedResult->aParams['display'], 'immutable' => true]]]);
else
$aResult = $mixedResult;

return [
$aResult
];
}

public function serviceEntityParent ($iContentId = 0, $aParams = [])
Expand Down

0 comments on commit c858628

Please sign in to comment.