Kaynağa Gözat

Ticket #4716 - Alerts(hooks) docs.

AntonLV 2 yıl önce
ebeveyn
işleme
70bd539681

+ 53 - 3
modules/base/connect/classes/BxBaseModConnectModule.php

@@ -78,7 +78,22 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
     {
     {
         $mixed = $this->_createProfileRaw($aProfileInfo, $sAlternativeName);
         $mixed = $this->_createProfileRaw($aProfileInfo, $sAlternativeName);
 
 
-        bx_alert($this->getName(), 'profile_created', 0, 0, array('override_result' => &$mixed, 'remote_profile_info' => $aProfileInfo));
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_connect-profile_created '{module_name}', 'profile_created' - hook after a profile was created 
+         * - $unit_name - module name
+         * - $action - equals `profile_created`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [string] or [array] by ref, result of profile creation, can be overridden in hook processing. If `string` then show error, if `array` with `join_page_redirect` key then show Create Account page, if `array` with `profile_id` key then redirect to profile page
+         *      - `remote_profile_info` - [array] array with remote profile info
+         * @hook @ref hook-bx_base_connect-profile_created
+         */
+        bx_alert($this->getName(), 'profile_created', 0, 0, [
+            'override_result' => &$mixed, 
+            'remote_profile_info' => $aProfileInfo
+        ]);
         
         
         // display error
         // display error
         if (is_string($mixed)) {
         if (is_string($mixed)) {
@@ -131,7 +146,24 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
         // convert fields to unique format
         // convert fields to unique format
         $aFieldsProfile = $aFieldsAccount = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
         $aFieldsProfile = $aFieldsAccount = $this->_convertRemoteFields($aProfileInfo, $sAlternativeName);
 
 
-        bx_alert($this->getName(), 'fields_converted', 0, 0, array('override_profile_fields' => &$aFieldsProfile, 'override_account_fields' => &$aFieldsAccount, 'remote_profile_info' => $aProfileInfo));
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_connect-fields_converted '{module_name}', 'fields_converted' - hook before a profile was created, which allows to modify account and/or profile fields before creation
+         * - $unit_name - module name
+         * - $action - equals `fields_converted`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_profile_fields` - [array] by ref, profile fields, can be overridden in hook processing
+         *      - `override_account_fields` - [array] by ref, account fields, can be overridden in hook processing
+         *      - `remote_profile_info` - [array] array with remote profile info
+         * @hook @ref hook-bx_base_connect-fields_converted
+         */
+        bx_alert($this->getName(), 'fields_converted', 0, 0, [
+            'override_profile_fields' => &$aFieldsProfile, 
+            'override_account_fields' => &$aFieldsAccount, 
+            'remote_profile_info' => $aProfileInfo
+        ]);
 
 
         if (empty($aFieldsProfile['email']))
         if (empty($aFieldsProfile['email']))
             return _t('_Incorrect Email');
             return _t('_Incorrect Email');
@@ -160,7 +192,25 @@ class BxBaseModConnectModule extends BxBaseModGeneralModule
         // antispam check
         // antispam check
         $sErrorMsg = '';
         $sErrorMsg = '';
         $bSetPendingApproval = false;
         $bSetPendingApproval = false;
-        bx_alert('account', 'check_join', 0, false, array('error_msg' => &$sErrorMsg, 'email' => $aFieldsAccount['email'], 'approve' => &$bSetPendingApproval));
+        
+        /**
+         * @hooks
+         * @hookdef hook-account-check_join 'account', 'check_join' - hook to check email address for spam
+         * - $unit_name - equals `account`
+         * - $action - equals `check_join`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `error_msg` - [string] by ref, error message, can be overridden in hook processing
+         *      - `email` - [string] email address to check
+         *      - `approve` - [boolean] by ref, pending approval status for created profile, can be overridden in hook processing
+         * @hook @ref hook-account-check_join
+         */
+        bx_alert('account', 'check_join', 0, false, [
+            'error_msg' => &$sErrorMsg, 
+            'email' => $aFieldsAccount['email'], 
+            'approve' => &$bSetPendingApproval
+        ]);
         if ($sErrorMsg)
         if ($sErrorMsg)
             return $sErrorMsg;
             return $sErrorMsg;
 
 

+ 24 - 0
modules/base/general/classes/BxBaseModGeneralAlertsResponse.php

@@ -72,6 +72,18 @@ class BxBaseModGeneralAlertsResponse extends BxDolAlertsResponse
                 $this->_oModule->onFailed($iContentId);
                 $this->_oModule->onFailed($iContentId);
 
 
                 if($bNotify)
                 if($bNotify)
+                    /**
+                     * @hooks
+                     * @hookdef hook-bx_base_general-publish_failed '{module_name}', 'publish_failed' - hook to notify about failed content publishing
+                     * - $unit_name - module name
+                     * - $action - equals `publish_failed`
+                     * - $object_id - content id 
+                     * - $sender_id - system bot profile id
+                     * - $extra_params - array of additional params with the following array keys:
+                     *      - `object_author_id` - [int] content author profile id
+                     *      - `privacy_view` - [int] privacy for view action, equals to BX_DOL_PG_ALL, @see BxDolPrivacy
+                     * @hook @ref hook-bx_base_general-publish_failed
+                     */
                     bx_alert($this->_oModule->getName(), 'publish_failed', $aContentInfo[$CNF['FIELD_ID']], $iSystemBotProfileId, array(
                     bx_alert($this->_oModule->getName(), 'publish_failed', $aContentInfo[$CNF['FIELD_ID']], $iSystemBotProfileId, array(
                         'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']],
                         'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']],
                         'privacy_view' => BX_DOL_PG_ALL
                         'privacy_view' => BX_DOL_PG_ALL
@@ -101,6 +113,18 @@ class BxBaseModGeneralAlertsResponse extends BxDolAlertsResponse
         $this->_oModule->onPublished($iContentId);
         $this->_oModule->onPublished($iContentId);
 
 
         if($bNotify)
         if($bNotify)
+            /**
+             * @hooks
+             * @hookdef hook-bx_base_general-publish_succeeded '{module_name}', 'publish_succeeded' - hook to notify about successfully published content
+             * - $unit_name - module name
+             * - $action - equals `publish_succeeded`
+             * - $object_id - content id 
+             * - $sender_id - system bot profile id
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `object_author_id` - [int] content author profile id
+             *      - `privacy_view` - [int] privacy for view action, equals to BX_DOL_PG_ALL, @see BxDolPrivacy
+             * @hook @ref hook-bx_base_general-publish_succeeded
+             */
             bx_alert($this->MODULE, 'publish_succeeded', $aContentInfo[$CNF['FIELD_ID']], $iSystemBotProfileId, [
             bx_alert($this->MODULE, 'publish_succeeded', $aContentInfo[$CNF['FIELD_ID']], $iSystemBotProfileId, [
                 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']],
                 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']],
                 'privacy_view' => BX_DOL_PG_ALL
                 'privacy_view' => BX_DOL_PG_ALL

+ 11 - 0
modules/base/general/classes/BxBaseModGeneralConfig.php

@@ -44,6 +44,17 @@ class BxBaseModGeneralConfig extends BxDolModuleConfig
 
 
     public function getCNF()
     public function getCNF()
     {
     {
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-get_cnf '{module_name}', 'get_cnf' - hook to override module's configuration array
+         * - $unit_name - module name
+         * - $action - equals `get_cnf`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `override_result` - [array] by ref, module's configuration array, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-get_cnf
+         */
         bx_alert($this->getName(), 'get_cnf', 0, 0, ['override_result' => &$this->CNF]);
         bx_alert($this->getName(), 'get_cnf', 0, 0, ['override_result' => &$this->CNF]);
         return $this->CNF;
         return $this->CNF;
     }
     }

+ 29 - 1
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -79,7 +79,35 @@ class BxBaseModGeneralDb extends BxDolModuleDb
 
 
             case 'search_ids':
             case 'search_ids':
                 $this->_getEntriesBySearchIds($aParams, $aMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause);
                 $this->_getEntriesBySearchIds($aParams, $aMethod, $sSelectClause, $sJoinClause, $sWhereClause, $sOrderClause, $sLimitClause);
-                bx_alert('system', 'search_ids', 0, 0, array('module_name' => $this->_oConfig->getName(), 'params' => &$aParams, 'select_clause' => &$sSelectClause, 'join_clause' => &$sJoinClause, 'where_clause' => &$sWhereClause, 'order_clause' => &$sOrderClause, 'limit_clause' => &$sLimitClause, 'bindings' => &$aMethod['params'][1]));
+                
+                /**
+                 * @hooks
+                 * @hookdef hook-system-search_ids 'system', 'search_ids' - hook to modify a list found content ids
+                 * - $unit_name - equals `system`
+                 * - $action - equals `search_ids`
+                 * - $object_id - not used
+                 * - $sender_id - not used
+                 * - $extra_params - array of additional params with the following array keys:
+                 *      - `module_name` - [string] content's module name
+                 *      - `params` - [array] by ref, override search params
+                 *      - `select_clause` - [string] by ref, select part of MySQL query, can be overridden in hook processing
+                 *      - `join_clause` - [string] by ref, join part of MySQL query, can be overridden in hook processing
+                 *      - `where_clause` - [string] by ref, where part of MySQL query, can be overridden in hook processing
+                 *      - `order_clause` - [string] by ref, order part of MySQL query, can be overridden in hook processing
+                 *      - `limit_clause` - [string] by ref, limit part of MySQL query, can be overridden in hook processing
+                 *      - `bindings` - [array] by ref, bindings of MySQL query, can be overridden in hook processing
+                 * @hook @ref hook-system-search_ids
+                 */
+                bx_alert('system', 'search_ids', 0, 0, [
+                    'module_name' => $this->_oConfig->getName(), 
+                    'params' => &$aParams, 
+                    'select_clause' => &$sSelectClause, 
+                    'join_clause' => &$sJoinClause, 
+                    'where_clause' => &$sWhereClause, 
+                    'order_clause' => &$sOrderClause, 
+                    'limit_clause' => &$sLimitClause, 
+                    'bindings' => &$aMethod['params'][1]
+                ]);
                 break;
                 break;
 
 
             case 'all_ids':
             case 'all_ids':

+ 14 - 2
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -608,10 +608,22 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         }
         }
         $aQueryParams['fi'] = '';
         $aQueryParams['fi'] = '';
         
         
-        bx_alert('system', 'editor_query_params', 0, 0, array(
+        /**
+         * @hooks
+         * @hookdef hook-system-editor_query_params 'system', 'editor_query_params' - hook to override http(s) request's query params, which is used in HTML editor
+         * - $unit_name - equals `system`
+         * - $action - equals `editor_query_params`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `form` - [object] an instance of form, @see BxDolForm
+         *      - `override_result` - [array] by ref, query string params, can be overridden in hook processing
+         * @hook @ref hook-system-editor_query_params
+         */
+        bx_alert('system', 'editor_query_params', 0, 0, [
             'form' => $this,
             'form' => $this,
             'override_result' => &$aQueryParams
             'override_result' => &$aQueryParams
-        ));
+        ]);
         
         
         return $aQueryParams;
         return $aQueryParams;
     }
     }

+ 46 - 9
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -329,11 +329,24 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if ($sUrl == '')
         if ($sUrl == '')
             $sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
             $sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
         
         
-        bx_alert($this->_oModule->getName(), 'redirect_after_add', 0, false, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-redirect_after_add '{module_name}', 'redirect_after_add' - hook to override redirect URL which is used after content creation
+         * - $unit_name - module name
+         * - $action - equals `redirect_after_add`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `ajax_mode` - [boolean] dynamic loading is used or not
+         *      - `content` - [array] content info array as key&value pairs
+         *      - `override_result` - [string] by ref, redirect URL, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-redirect_after_add
+         */
+        bx_alert($this->_oModule->getName(), 'redirect_after_add', 0, false, [
             'ajax_mode' => $this->_bAjaxMode,
             'ajax_mode' => $this->_bAjaxMode,
             'content' => $aContentInfo,
             'content' => $aContentInfo,
             'override_result' => &$sUrl,
             'override_result' => &$sUrl,
-        ));
+        ]);
 
 
         if (bx_is_api())
         if (bx_is_api())
             return [bx_api_get_block('redirect', ['uri' => BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000])];
             return [bx_api_get_block('redirect', ['uri' => BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000])];
@@ -423,10 +436,17 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if ($sUrl == '')
         if ($sUrl == '')
             $sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
             $sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
 
 
-        bx_alert($this->_oModule->getName(), 'redirect_after_edit', 0, false, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-redirect_after_edit '{module_name}', 'redirect_after_edit' - hook to override redirect URL which is used after content changing
+         * It's equivalent to @ref hook-bx_base_general-redirect_after_add
+         * except `ajax_mode` parameter in $extra_params is missing
+         * @hook @ref hook-bx_base_general-redirect_after_edit
+         */
+        bx_alert($this->_oModule->getName(), 'redirect_after_edit', 0, false, [
             'content' => $aContentInfo,
             'content' => $aContentInfo,
             'override_result' => &$sUrl,
             'override_result' => &$sUrl,
-        ));
+        ]);
 
 
         if (bx_is_api())
         if (bx_is_api())
             return bx_api_get_block('redirect', ['uri' => '/' . BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000]);
             return bx_api_get_block('redirect', ['uri' => '/' . BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000]);
@@ -482,11 +502,18 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
             'profile_id' => bx_get_logged_profile_id(),
             'profile_id' => bx_get_logged_profile_id(),
         );
         );
 
 
-        bx_alert($this->_oModule->getName(), 'redirect_after_delete', 0, false, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-redirect_after_delete '{module_name}', 'redirect_after_delete' - hook to override redirect URL which is used after content deletion
+         * It's equivalent to @ref hook-bx_base_general-redirect_after_add
+         * except `markers` parameter was added to $extra_params. It allows to override an array of markers, which can be parsed in URL.
+         * @hook @ref hook-bx_base_general-redirect_after_delete
+         */
+        bx_alert($this->_oModule->getName(), 'redirect_after_delete', 0, false, [
             'content' => $aContentInfo,
             'content' => $aContentInfo,
             'markers' => &$aMarkers,
             'markers' => &$aMarkers,
             'override_result' => &$sUrl,
             'override_result' => &$sUrl,
-        ));
+        ]);
         
         
         if (bx_is_api())
         if (bx_is_api())
             return bx_api_get_block('redirect', ['uri' => '/' . BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000]);
             return bx_api_get_block('redirect', ['uri' => '/' . BxDolPermalinks::getInstance()->permalink($sUrl), 'timeout' => 1000]);
@@ -527,10 +554,20 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if ($sResult = $this->onDataDeleteAfter ($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $oProfile))
         if ($sResult = $this->onDataDeleteAfter ($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $oProfile))
             return $sResult;
             return $sResult;
 
 
-        // create an alert
-        bx_alert($this->_oModule->getName(), 'deleted', $aContentInfo[$CNF['FIELD_ID']], false, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-deleted '{module_name}', 'deleted' - hook after content was deleted
+         * - $unit_name - module name
+         * - $action - equals `deleted`
+         * - $object_id - content id
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `content` - [array] by ref, content info array as key&value pairs, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-deleted
+         */
+        bx_alert($this->_oModule->getName(), 'deleted', $aContentInfo[$CNF['FIELD_ID']], false, [
             'content' => &$aContentInfo
             'content' => &$aContentInfo
-        ));
+        ]);
 
 
         return '';
         return '';
     }
     }

+ 28 - 3
modules/base/general/classes/BxBaseModGeneralMenuSnippetMeta.php

@@ -351,7 +351,7 @@ class BxBaseModGeneralMenuSnippetMeta extends BxTemplMenuUnitMeta
     {
     {
         $sResult = false;
         $sResult = false;
 
 
-        $a = array(
+        $a = [
             'res' => &$sResult, 
             'res' => &$sResult, 
             'menu' => $this->_sObject, 
             'menu' => $this->_sObject, 
             'menu_object' => $this, 
             'menu_object' => $this, 
@@ -359,10 +359,35 @@ class BxBaseModGeneralMenuSnippetMeta extends BxTemplMenuUnitMeta
             'module' => $this->_sModule,
             'module' => $this->_sModule,
             'content_id' => $this->_iContentId,
             'content_id' => $this->_iContentId,
             'content_data' => $this->_aContentInfo,
             'content_data' => $this->_aContentInfo,
-        );
+        ];
+        
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-menu_custom_item '{module_name}', 'menu_custom_item' - hook to override menu item
+         * - $unit_name - module name
+         * - $action - equals `menu_custom_item`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `res` - [string] by ref, menu item code, can be overridden in hook processing
+         *      - `menu` - [string] menu name
+         *      - `menu_object` - [object] an instance of menu, @see BxDolMenu
+         *      - `item` - [array] menu item array as key&value pairs
+         *      - `module` - [string] module name
+         *      - `content_id` - [int] content id
+         *      - `content_data` - [array] content info array as key&value pairs
+         * @hook @ref hook-bx_base_general-menu_custom_item
+         */
         bx_alert($this->_sModule, 'menu_custom_item', 0, 0, $a);
         bx_alert($this->_sModule, 'menu_custom_item', 0, 0, $a);
-        bx_alert('menu', 'menu_custom_item', 0, 0, $a);
         
         
+        /**
+         * @hooks
+         * @hookdef hook-menu-menu_custom_item 'menu', 'menu_custom_item' - hook to override menu item
+         * It's equivalent to @ref hook-bx_base_general-menu_custom_item
+         * @hook @ref hook-menu-menu_custom_item
+         */
+        bx_alert('menu', 'menu_custom_item', 0, 0, $a);
+
         if (false !== $sResult)
         if (false !== $sResult)
             return $sResult;
             return $sResult;
 
 

+ 182 - 16
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -60,7 +60,26 @@ class BxBaseModGeneralModule extends BxDolModule
         $bModerator = $this->_isModerator();
         $bModerator = $this->_isModerator();
 
 
         $mixedResult = null;
         $mixedResult = null;
-        bx_alert($this->getName(), 'is_entry_active', 0, 0, ['viewer_id' => $iProfileId, 'is_moderator' => $bModerator, 'content_info' => $aContentInfo, 'override_result' => &$mixedResult]);
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-is_entry_active '{module_name}', 'is_entry_active' - hook to override whether an entry (content) active or not
+         * - $unit_name - module name
+         * - $action - equals `is_entry_active`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `viewer_id` - [int] viewer profile id
+         *      - `is_moderator` - [boolean] is viewer has moderator status or not
+         *      - `content_info` - [array] content info array as key&value pairs
+         *      - `override_result` - [boolean] by ref, boolean value which determines whether entry (content) active or not, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-is_entry_active
+         */
+        bx_alert($this->getName(), 'is_entry_active', 0, 0, [
+            'viewer_id' => $iProfileId, 
+            'is_moderator' => $bModerator, 
+            'content_info' => $aContentInfo, 
+            'override_result' => &$mixedResult
+        ]);
         if($mixedResult !== null)
         if($mixedResult !== null)
             return $mixedResult;
             return $mixedResult;
 
 
@@ -93,7 +112,24 @@ class BxBaseModGeneralModule extends BxDolModule
             $iProfileId = bx_get_logged_profile_id();
             $iProfileId = bx_get_logged_profile_id();
 
 
         $mixedResult = null;
         $mixedResult = null;
-        bx_alert($this->getName(), 'is_entry_author', 0, 0, ['viewer_id' => $iProfileId, 'content_info' => $aContentInfo, 'override_result' => &$mixedResult]);
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-is_entry_author '{module_name}', 'is_entry_author' - hook to check if a viewer is an author of viewed entry (content) or not
+         * - $unit_name - module name
+         * - $action - equals `is_entry_author`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `viewer_id` - [int] viewer profile id
+         *      - `content_info` - [array] content info array as key&value pairs
+         *      - `override_result` - [boolean] by ref, boolean value which determines whether the viewer is an author of viewed entry (content) or not, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-is_entry_author
+         */
+        bx_alert($this->getName(), 'is_entry_author', 0, 0, [
+            'viewer_id' => $iProfileId, 
+            'content_info' => $aContentInfo, 
+            'override_result' => &$mixedResult
+        ]);
         if($mixedResult !== null)
         if($mixedResult !== null)
             return $mixedResult;
             return $mixedResult;
 
 
@@ -1360,12 +1396,26 @@ class BxBaseModGeneralModule extends BxDolModule
             }
             }
         }
         }
 
 
-        bx_alert('system', 'get_object_form', 0, 0, array(
+        /**
+         * @hooks
+         * @hookdef hook-system-get_object_form 'system', 'get_object_form' - hook to override an object of create content form, @see BxDolForm
+         * - $unit_name - equals `system`
+         * - $action - equals `get_object_form`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string] module name
+         *      - `type` - [string] 'add', 'edit', 'view' or 'delete' form display type
+         *      - `params` - [array] form params array as key&value pairs
+         *      - `form` - [object] by ref, an object of create content form, @see BxDolForm, can be overridden in hook processing
+         * @hook @ref hook-system-get_object_form
+         */
+        bx_alert('system', 'get_object_form', 0, 0, [
             'module' => $this->_oConfig->getName(),
             'module' => $this->_oConfig->getName(),
             'type' => $sType,
             'type' => $sType,
             'params' => $aParams,
             'params' => $aParams,
             'form' => &$oForm
             'form' => &$oForm
-        ));
+        ]);
 
 
         return $oForm;
         return $oForm;
     }
     }
@@ -2648,14 +2698,30 @@ class BxBaseModGeneralModule extends BxDolModule
         ));
         ));
 
 
         $sResult = false;
         $sResult = false;
-        bx_alert('system', 'get_badges', 0, 0, array(
+        /**
+         * @hooks
+         * @hookdef hook-system-get_badges 'system', 'get_badges' - hook to override bages assigned to an entry (content)
+         * - $unit_name - equals `system`
+         * - $action - equals `get_badges`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string] module name
+         *      - `content_id` - [int] content id
+         *      - `is_single` - [boolean] only one badge can be used or not
+         *      - `is_compact` - [boolean] badge in compact mode or not
+         *      - `badges` - [array] a list of all badges assigned to the content
+         *      - `override_result` - [string] or [boolean] by ref, if string is returned then it will be used as resulting badges code, can be overridden in hook processing
+         * @hook @ref hook-system-get_badges
+         */
+        bx_alert('system', 'get_badges', 0, 0, [
             'module' => $sModule, 
             'module' => $sModule, 
             'content_id' => $iContentId,
             'content_id' => $iContentId,
             'is_single' => $bIsSingle,
             'is_single' => $bIsSingle,
             'is_compact' => $bIsCompact,
             'is_compact' => $bIsCompact,
             'badges' => $aBadges, 
             'badges' => $aBadges, 
             'override_result' => &$sResult
             'override_result' => &$sResult
-        ));
+        ]);
         if($sResult !== false)
         if($sResult !== false)
             return $sResult;
             return $sResult;
 
 
@@ -2743,8 +2809,26 @@ class BxBaseModGeneralModule extends BxDolModule
     {
     {
         $mixedResult = $this->_serviceCheckAllowedViewForProfile ($aDataEntry, $isPerformAction, $iProfileId);
         $mixedResult = $this->_serviceCheckAllowedViewForProfile ($aDataEntry, $isPerformAction, $iProfileId);
 
 
-        // check alert to allow custom checks        
-        bx_alert('system', 'check_allowed_view', 0, 0, array('module' => $this->getName(), 'content_info' => $aDataEntry, 'profile_id' => $iProfileId, 'override_result' => &$mixedResult));
+        /**
+         * @hooks
+         * @hookdef hook-system-check_allowed_view 'system', 'check_allowed_view' - hook to override the result of checking whether 'view' action allowed or not to specified profile
+         * - $unit_name - equals `system`
+         * - $action - equals `check_allowed_view`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string] module name
+         *      - `content_info` - [array] content info array as key&value pairs
+         *      - `profile_id` - [boolean] or [int] profile id to be checked the availability of the action to
+         *      - `override_result` - [string] or [int] by ref, check action result, can be overridden in hook processing. Return string with an error if action isn't allowed or CHECK_ACTION_RESULT_ALLOWED, @see BxDolAcl
+         * @hook @ref hook-system-check_allowed_view
+         */
+        bx_alert('system', 'check_allowed_view', 0, 0, [
+            'module' => $this->getName(), 
+            'content_info' => $aDataEntry, 
+            'profile_id' => $iProfileId, 
+            'override_result' => &$mixedResult
+        ]);
 
 
         return $mixedResult;
         return $mixedResult;
     }
     }
@@ -2759,9 +2843,19 @@ class BxBaseModGeneralModule extends BxDolModule
      */
      */
     public function checkAllowedBrowse ()
     public function checkAllowedBrowse ()
     {
     {
-        // check alert to allow custom checks
         $mixedResult = null;
         $mixedResult = null;
-        bx_alert('system', 'check_allowed_browse', 0, 0, array('module' => $this->getName(), 'profile_id' => $this->_iProfileId, 'override_result' => &$mixedResult));
+        /**
+         * @hooks
+         * @hookdef hook-system-check_allowed_browse 'system', 'check_allowed_browse' - hook to override the result of checking whether 'browse' action allowed or not to currently logged in profile
+         * It's equivalent to @ref hook-system-check_allowed_view 
+         * except `content_info` parameter in $extra_params is missing
+         * @hook @ref hook-system-check_allowed_browse
+         */
+        bx_alert('system', 'check_allowed_browse', 0, 0, [
+            'module' => $this->getName(), 
+            'profile_id' => $this->_iProfileId, 
+            'override_result' => &$mixedResult
+        ]);
         if($mixedResult !== null)
         if($mixedResult !== null)
             return $mixedResult;
             return $mixedResult;
 
 
@@ -3122,8 +3216,20 @@ class BxBaseModGeneralModule extends BxDolModule
         if(!$aContentInfo)
         if(!$aContentInfo)
             return;
             return;
 
 
-        $aParams = array('object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]);
-        bx_alert($this->getName(), 'failed', $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], $aParams);
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-failed '{module_name}', 'failed' - hook after content creation when publishing was failed
+         * - $unit_name - module name
+         * - $action - equals `failed`
+         * - $object_id - content id
+         * - $sender_id - content author profile id
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `object_author_id` - [int] content author profile id
+         * @hook @ref hook-bx_base_general-failed
+         */
+        bx_alert($this->getName(), 'failed', $iContentId, $aContentInfo[$CNF['FIELD_AUTHOR']], [
+            'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]
+        ]);
     }
     }
 
 
     public function onApprove($mixedContent)
     public function onApprove($mixedContent)
@@ -3528,7 +3634,28 @@ class BxBaseModGeneralModule extends BxDolModule
             'data_api' => &$aDataApi,
             'data_api' => &$aDataApi,
         ];
         ];
 
 
+        /**
+         * @hooks
+         * @hookdef hook-system-decode_data_api 'system', 'decode_data_api' - hook to override content data prepared for sending in API response
+         * - $unit_name - equals `system`
+         * - $action - equals `decode_data_api`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `module` - [string] module name
+         *      - `data` - [array] content info array as key&value pairs
+         *      - `params` - [array] params array as key&value pairs
+         *      - `data_api` - [array] by ref, content data prepared for sending in API response, can be overridden in hook processing
+         * @hook @ref hook-system-decode_data_api
+         */
         bx_alert('system', 'decode_data_api', 0, 0, $aExtras);
         bx_alert('system', 'decode_data_api', 0, 0, $aExtras);
+
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-decode_data_api '{module_name}', 'decode_data_api' - hook to override content data prepared for sending in API response
+         * It's equivalent to @ref hook-system-decode_data_api
+         * @hook @ref hook-bx_base_general-decode_data_api
+         */
         bx_alert($sModule, 'decode_data_api', 0, 0, $aExtras);
         bx_alert($sModule, 'decode_data_api', 0, 0, $aExtras);
 
 
         return $aDataApi;
         return $aDataApi;
@@ -3596,11 +3723,24 @@ class BxBaseModGeneralModule extends BxDolModule
             if(is_numeric($iKey) && isset($mixedValue['name']) && $mixedValue['name'] == 'do_submit')
             if(is_numeric($iKey) && isset($mixedValue['name']) && $mixedValue['name'] == 'do_submit')
                 $oForm->aInputs['controls'][$iKey]['value'] = _t('_sys_form_manage_input_do_submit_approve');
                 $oForm->aInputs['controls'][$iKey]['value'] = _t('_sys_form_manage_input_do_submit_approve');
 
 
-        bx_alert($this->_oConfig->getName(), 'get_approve_form', 0, 0, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-get_approve_form '{module_name}', 'get_approve_form' - hook to override approve content form
+         * - $unit_name - module name
+         * - $action - equals `get_approve_form`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `content_id` - [int] content id
+         *      - `content_info` - [array] content info array as key&value pairs
+         *      - `override_result` - [object] by ref, an instance of approve content form, @see BxDolForm, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-get_approve_form
+         */
+        bx_alert($this->_oConfig->getName(), 'get_approve_form', 0, 0, [
             'content_id' => $iContentId,
             'content_id' => $iContentId,
             'content_info' => $aContentInfo,
             'content_info' => $aContentInfo,
             'override_result' => &$oForm
             'override_result' => &$oForm
-        ));
+        ]);
 
 
         return $oForm;
         return $oForm;
     }
     }
@@ -3618,13 +3758,28 @@ class BxBaseModGeneralModule extends BxDolModule
             'notes' => $oForm->getCleanValue('notes'),
             'notes' => $oForm->getCleanValue('notes'),
         );
         );
 
 
-        bx_alert($this->_oConfig->getName(), 'get_approve_message', 0, 0, array(
+        /**
+         * @hooks
+         * @hookdef hook-bx_base_general-get_approve_message '{module_name}', 'get_approve_form' - hook to override approve content message
+         * - $unit_name - module name
+         * - $action - equals `get_approve_message`
+         * - $object_id - not used
+         * - $sender_id - not used
+         * - $extra_params - array of additional params with the following array keys:
+         *      - `content_id` - [int] content id
+         *      - `content_info` - [array] content info array as key&value pairs
+         *      - `form` - [object] an instance of approve content form
+         *      - `email_template` - [string] by ref, email template name, @see BxDolEmailTemplates, can be overridden in hook processing
+         *      - `email_params` - [array] by ref, email template params, can be overridden in hook processing
+         * @hook @ref hook-bx_base_general-get_approve_message
+         */
+        bx_alert($this->_oConfig->getName(), 'get_approve_message', 0, 0, [
             'content_id' => $iContentId,
             'content_id' => $iContentId,
             'content_info' => $aContentInfo,
             'content_info' => $aContentInfo,
             'form' => $oForm,
             'form' => $oForm,
             'email_template' => &$sETemplate,
             'email_template' => &$sETemplate,
             'email_params' => &$aEParams
             'email_params' => &$aEParams
-        ));
+        ]);
 
 
         return sendMailTemplate($sETemplate, 0, $aContentInfo[$CNF['FIELD_AUTHOR']], $aEParams);
         return sendMailTemplate($sETemplate, 0, $aContentInfo[$CNF['FIELD_AUTHOR']], $aEParams);
     }
     }
@@ -3659,6 +3814,17 @@ class BxBaseModGeneralModule extends BxDolModule
             return;
             return;
 
 
         foreach($aRecipients as $iRecipientId)
         foreach($aRecipients as $iRecipientId)
+            /**
+             * @hooks
+             * @hookdef hook-bx_base_general-pending_approval '{module_name}', 'pending_approval' - hook to notify admins/moderators about new pending approval content
+             * - $unit_name - module name
+             * - $action - equals `pending_approval`
+             * - $object_id - content id
+             * - $sender_id - content author profile id
+             * - $extra_params - array of additional params with the following array keys:
+             *      - `object_author_id` - [int] admin/moderator profile id
+             * @hook @ref hook-bx_base_general-pending_approval
+             */
             bx_alert($sModule, 'pending_approval', $aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_AUTHOR']], [
             bx_alert($sModule, 'pending_approval', $aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_AUTHOR']], [
                 'object_author_id' => (int)$iRecipientId
                 'object_author_id' => (int)$iRecipientId
             ]);
             ]);