{"id":15296318,"url":"https://github.com/proklung/bitrix.module.boilerplate","last_synced_at":"2025-08-13T23:06:01.944Z","repository":{"id":57045112,"uuid":"359063987","full_name":"ProklUng/bitrix.module.boilerplate","owner":"ProklUng","description":"Вспомогательные классы для работы с модулями Битрикс","archived":false,"fork":false,"pushed_at":"2023-05-15T05:36:36.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-20T09:52:38.723Z","etag":null,"topics":["bitrix","bitrix-module","php","php-library","php7"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProklUng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-18T06:31:35.000Z","updated_at":"2024-08-22T11:08:38.000Z","dependencies_parsed_at":"2025-04-13T19:41:56.810Z","dependency_job_id":"ac2e8108-4163-4d42-abcf-540fa5ea565d","html_url":"https://github.com/ProklUng/bitrix.module.boilerplate","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ProklUng/bitrix.module.boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProklUng%2Fbitrix.module.boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProklUng%2Fbitrix.module.boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProklUng%2Fbitrix.module.boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProklUng%2Fbitrix.module.boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProklUng","download_url":"https://codeload.github.com/ProklUng/bitrix.module.boilerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProklUng%2Fbitrix.module.boilerplate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270330595,"owners_count":24565816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitrix","bitrix-module","php","php-library","php7"],"created_at":"2024-09-30T18:10:02.954Z","updated_at":"2025-08-13T23:06:01.901Z","avatar_url":"https://github.com/ProklUng.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Вспомогательные классы для работы с модулями Битрикс\n\n## Описание\n\nЦель: минимизация дублирования кода при написании модулей.\n\n## Возможности\n\n#### Адаптер для настроек модуля\n\nПростая обертка над *Bitrix\\Main\\Config\\Option*\n\n#### Готовая страница настроек модуля\n\nСтандартная страница настроек модуля.\n\n#### ModuleUtilsTrait\n\nОбщий для стандартного модуля функционал.\n\nФайл `/install/index.php`:\n\n```php\nuse Bitrix\\Main\\Localization\\Loc;\nuse ProklUng\\Module\\Boilerplate\\Module;\nuse ProklUng\\Module\\Boilerplate\\ModuleUtilsTrait;\n\nLoc::loadMessages(__FILE__);\n\nclass example_module extends CModule\n{\n    use ModuleUtilsTrait;\n\n    public function __construct()\n    {\n        $arModuleVersion = [];\n\n        include __DIR__.'/version.php';\n\n        if (is_array($arModuleVersion)\n            \u0026\u0026\n            array_key_exists('VERSION', $arModuleVersion)) {\n            $this-\u003eMODULE_VERSION = $arModuleVersion['VERSION'];\n            $this-\u003eMODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE'];\n        }\n\n        $this-\u003eMODULE_FULL_NAME = 'module';\n        $this-\u003eMODULE_VENDOR = 'example';\n        $prefixLangCode = 'MODULE';\n\n        $this-\u003eMODULE_NAME = Loc::getMessage($prefixLangCode.'_MODULE_NAME');\n        $this-\u003eMODULE_ID = $this-\u003eMODULE_VENDOR.'.'.$this-\u003eMODULE_FULL_NAME;\n\n        $this-\u003eMODULE_DESCRIPTION = Loc::getMessage($prefixLangCode.'_MODULE_DESCRIPTION');\n        $this-\u003eMODULE_GROUP_RIGHTS = 'N';\n        $this-\u003ePARTNER_NAME = Loc::getMessage($prefixLangCode.'_MODULE_PARTNER_NAME');\n        $this-\u003ePARTNER_URI = Loc::getMessage($prefixLangCode.'MODULE_PARTNER_URI');\n\n        $this-\u003emoduleManager = new Module(\n            [\n                'MODULE_ID' =\u003e $this-\u003eMODULE_ID,\n                'VENDOR_ID' =\u003e $this-\u003eMODULE_VENDOR,\n                'MODULE_VERSION' =\u003e $this-\u003eMODULE_VERSION,\n                'MODULE_VERSION_DATE' =\u003e $this-\u003eMODULE_VERSION_DATE,\n                'ADMIN_FORM_ID' =\u003e $this-\u003eMODULE_VENDOR.'_settings_form',\n            ]\n        );\n\n        $this-\u003emoduleManager-\u003eaddModuleInstance($this); // Регистрация экземпляра модуля.\n        $this-\u003eoptions(); // Подготовка данных для генерации админки модуля\n    }\n  }  \n```\n\nДалее при необходимости можно переопределить стандартные методы модуля (типа `InstallEvents()`).\n\n#### Module\n\nМенеджер модулей, зарегистрированных в системе посредством этого boilerplate.\n\n- ***showOptionsForm*** - вывод формы настроек модуля.\n- ***getOptionsManager*** - экземпляр класса `Options\\ModuleManager`. Настройки модуля.\n- ***addModuleInstance($moduleObject)*** - Статика. Добавить экземпляр модуля. Объект, отнаследованный от `CModule`.\n- ***getModuleInstance(string $moduleId)*** - Статика. Получить экземпляр класса модуля по ID.\n\n#### Опции модуля\n\nДобавляются методом `addOption` (и скопом - `addOptions`) класса `Options\\ModuleManager`.\n\n#### Меню опций модуля\n\nВ основном классе модуля должен быть отнаследован метод `getSchemaTabsAdmin`, описывающий массивом схему табов.\n\n```php\n    protected function getSchemaTabsAdmin() : array\n    {\n        // Все возможные параметры - https://dev.1c-bitrix.ru/api_help/main/general/admin.section/rubric_edit.php\n        return ['tab1' =\u003e [\n            'TAB' =\u003e 'Таб 1',\n            'TITLE' =\u003e 'Таб 1',\n        ],\n            'tab2' =\u003e [\n                'TAB' =\u003e 'Таб 2',\n                'TITLE' =\u003e 'Таб 2',\n            ]\n        ];\n    }\n```\n\nТакже должен отнаследоваться метод `getSchemaOptionsAdmin`, возвращающий схему связки опций модуля с табами:\n\n```php\n    protected function getSchemaOptionsAdmin() : array\n    {\n        return [\n            'Test_option_1' =\u003e\n                [\n                    'label' =\u003e 'Тестовая опция 1',\n                    'tab' =\u003e 'tab1', // На каком табе будет показываться input\n                    'type' =\u003e 'text', // Тип input-а\n                ],\n            'Test_option_2' =\u003e\n                [\n                    'label' =\u003e 'Тестовая опция 2',\n                    'tab' =\u003e 'tab2', // На каком табе будет показываться input\n                    'type' =\u003e 'text', // Тип input-а\n                ],\n        ];\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproklung%2Fbitrix.module.boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproklung%2Fbitrix.module.boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproklung%2Fbitrix.module.boilerplate/lists"}