PHP code example of proklung / bitrix.module.boilerplate
1. Go to this page and download the library: Download proklung/bitrix.module.boilerplate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
proklung / bitrix.module.boilerplate example snippets
use Bitrix\Main\Localization\Loc;
use ProklUng\Module\Boilerplate\Module;
use ProklUng\Module\Boilerplate\ModuleUtilsTrait;
Loc::loadMessages(__FILE__);
class example_module extends CModule
{
use ModuleUtilsTrait;
public function __construct()
{
$arModuleVersion = [];
'module';
$this->MODULE_VENDOR = 'example';
$prefixLangCode = 'MODULE';
$this->MODULE_NAME = Loc::getMessage($prefixLangCode.'_MODULE_NAME');
$this->MODULE_ID = $this->MODULE_VENDOR.'.'.$this->MODULE_FULL_NAME;
$this->MODULE_DESCRIPTION = Loc::getMessage($prefixLangCode.'_MODULE_DESCRIPTION');
$this->MODULE_GROUP_RIGHTS = 'N';
$this->PARTNER_NAME = Loc::getMessage($prefixLangCode.'_MODULE_PARTNER_NAME');
$this->PARTNER_URI = Loc::getMessage($prefixLangCode.'MODULE_PARTNER_URI');
$this->moduleManager = new Module(
[
'MODULE_ID' => $this->MODULE_ID,
'VENDOR_ID' => $this->MODULE_VENDOR,
'MODULE_VERSION' => $this->MODULE_VERSION,
'MODULE_VERSION_DATE' => $this->MODULE_VERSION_DATE,
'ADMIN_FORM_ID' => $this->MODULE_VENDOR.'_settings_form',
]
);
$this->moduleManager->addModuleInstance($this); // Регистрация экземпляра модуля.
$this->options(); // Подготовка данных для генерации админки модуля
}
}