12 private bool $canUseIntranetToolsManager;
13 private const INVENTORY_MANAGEMENT_TOOL_ID =
'inventory_management';
18 $this->canUseIntranetToolsManager = (
19 Loader::includeModule(
'intranet')
20 && class_exists(
'\Bitrix\Intranet\Settings\Tools\ToolsManager')
31 return $this->check(self::INVENTORY_MANAGEMENT_TOOL_ID);
34 private function check(
string $toolId): bool
36 if ($this->canUseIntranetToolsManager)
38 return ToolsManager::getInstance()->checkAvailabilityByToolId($toolId);
46 return $this->getStubComponentContent([
47 'sliderCode' => self::INVENTORY_MANAGEMENT_SLIDER_CODE,
53 return $this->getJs(self::INVENTORY_MANAGEMENT_SLIDER_CODE);
56 private function getStubComponentContent(array $data = []): string
60 if (!empty($data[
'sliderCode']))
62 $params[
'SLIDER_CODE'] = $data[
'sliderCode'];
67 $APPLICATION->IncludeComponent(
68 'bitrix:intranet.tool.inaccessibility',
72 [
'HIDE_ICONS' =>
'Y'],
75 return ob_get_clean();
78 private function getJs(
string $id): string
80 if (!Loader::includeModule(
'ui'))
86 top && top.BX.loadExt("ui.info-helper").then(() => {
87 top.BX.UI.InfoHelper.show("' . CUtil::JSEscape($id) .
'");