diff --git a/.module.json b/.module.json
index 779049a..fb2614b 100644
--- a/.module.json
+++ b/.module.json
@@ -4,6 +4,6 @@
"namespace": "Bx\\Nullable",
"gitUrl": "https://bitbucket.org/bellord13/bx.null/",
"version": "1.0.0",
- "date": "2024-01-01 00:00:00",
+ "date": "2025-01-01 00:00:00",
"deps": ["wt.core"]
}
\ No newline at end of file
diff --git a/admin/main/submenu/settings/include/config.php b/admin/main/submenu/settings/include/config.php
index ce942b2..3cfe04b 100644
--- a/admin/main/submenu/settings/include/config.php
+++ b/admin/main/submenu/settings/include/config.php
@@ -9,9 +9,41 @@ $data['env'] = $app->env();
?>
-
- $value) {
- ?>| = $key ?> | = $value ?> |
+ $value) {
+ ?>| = $key ?> | = $value ?> |
+
+
+ module()->getSrc();
+ $html = "if(file_exists(\$_SERVER['DOCUMENT_ROOT'] . '$src/init.php'))
+ include_once \$_SERVER['DOCUMENT_ROOT'] . '$src/init.php';
";
+ ?>
+
+ =$this->getCheckTemplate($app->isIncludeFileToInitPhp())?>
+ |
+
+ Модуль подключен в init.php
+ |
+
+
+ =$initPhpSrc?>
+ init.php отсутствует
+
+ =$html?>
+ |
+
+
+
\ No newline at end of file
diff --git a/clone.php b/clone.php
index 47ab37a..40d7d59 100644
--- a/clone.php
+++ b/clone.php
@@ -73,15 +73,22 @@ function _fix(ModuleEntity $newEntity, ModuleEntity $nullableEntity){
$new_file = $orig_file;
$cr = 0;
$new_file = str_replace($nullableEntity->getLangPrefix(), $newEntity->getLangPrefix(), $new_file, $cr);
- $new_file = str_replace($nullableEntity->fields()->id, $newEntity->fields()->id, $new_file, $cr);
- $new_file = str_replace($nullableEntity->fields()->prefix, $newEntity->fields()->prefix, $new_file, $cr);
+ $new_file = str_replace($nullableEntity->getId(), $newEntity->getId(), $new_file, $cr);
+ $new_file = str_replace($nullableEntity->getPrefix(), $newEntity->getPrefix(), $new_file, $cr);
$new_file = str_replace($nullableEntity->getNamespace(), $newEntity->getNamespace(), $new_file, $cr);
- $lastModuleName = collect(explode('.', $newEntity->fields()->id))->last();
- $lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last();
+ $new_file = str_replace(
+ ucfirst($nullableEntity->getProductCode()) . ': ' . ucfirst($nullableEntity->getProductCode()),
+ ucfirst($newEntity->getProductCode()) . ': ' . ucfirst($newEntity->getProductCode()),
+ $new_file,
+ $cr
+ );
+
+ $new_file = str_replace(ucfirst($nullableEntity->getProductCode()), ucfirst($newEntity->getProductCode()), $new_file, $cr);
+ $new_file = str_replace(ucfirst($nullableEntity->getCompanyCode()), ucfirst($newEntity->getCompanyCode()), $new_file, $cr);
+ $new_file = str_replace($nullableEntity->getProductCode(), $newEntity->getProductCode(), $new_file, $cr);
+ $new_file = str_replace($nullableEntity->getCompanyCode(), $newEntity->getCompanyCode(), $new_file, $cr);
- $new_file = str_replace(ucfirst($lastNullableModuleName), ucfirst($lastModuleName), $new_file, $cr);
- $new_file = str_replace(strtolower($lastNullableModuleName), strtolower($lastModuleName), $new_file, $cr);
echo $cr . ' ' .$path . PHP_EOL;
@@ -98,8 +105,9 @@ echo $newEntity->getId() . PHP_EOL;
copy_folder_safe($nullableEntity->getPath(), $newEntity->getPath(), true, true, [
'.git',
- 'clone.php',
'.module.json',
+ 'clone.php',
+ 'readme.md',
], function ($d1, &$d2) use ($nullableEntity, $newEntity){
$lastModuleName = collect(explode('.', $newEntity->fields()->id))->last();
$lastNullableModuleName = collect(explode('.', $nullableEntity->fields()->id))->last();
diff --git a/default_config.php b/default_config.php
index f1251c3..6f75382 100644
--- a/default_config.php
+++ b/default_config.php
@@ -4,4 +4,18 @@ return [
'MainAbstractFactory' => [
'Bx\Nullable\Factory\NullableFactory' => ['cache' => ['hit'], 'is_collection_query' => true],
],
+ 'events' => [
+ 'main:OnPageStart' => [
+ ['Bx\Nullable\Handlers\Autoloader', 'onPageStart'],
+ ],
+ 'main:OnProlog' => [
+ ['Bx\Nullable\Handlers\Autoloader', 'onProlog'],
+ ],
+ 'main:OnEpilog' => [
+ ['Bx\Nullable\Handlers\Autoloader', 'onEpilog'],
+ ],
+ 'main:OnBeforeProlog' => [
+ ['Bx\Nullable\Handlers\Autoloader', 'onBeforeProlog'],
+ ],
+ ],
];
\ No newline at end of file
diff --git a/lang/ru/install/index.php b/lang/ru/install/index.php
index ef05d02..81595cd 100644
--- a/lang/ru/install/index.php
+++ b/lang/ru/install/index.php
@@ -1,4 +1,4 @@
-
+includeFileToInitPhp;
+ }
+ $this->includeFileToInitPhp = $value;
+ return $this;
+ }
}
\ No newline at end of file
diff --git a/lib/Handlers/Autoloader.php b/lib/Handlers/Autoloader.php
new file mode 100644
index 0000000..8c229a6
--- /dev/null
+++ b/lib/Handlers/Autoloader.php
@@ -0,0 +1,11 @@
+