|
12 | 12 |
|
13 | 13 | class WebentorCoreServiceProvider extends ServiceProvider |
14 | 14 | { |
| 15 | + public function register(): void |
| 16 | + { |
| 17 | + // WEBENTOR_CORE_PHP_PATH is normally defined by the consumer theme's |
| 18 | + // functions.php (it's also consumed by config/view.php, which runs |
| 19 | + // before providers register). Fallback to the package directory so |
| 20 | + // the provider still works in contexts where the consumer omitted it. |
| 21 | + if (!defined('WEBENTOR_CORE_PHP_PATH')) { |
| 22 | + define('WEBENTOR_CORE_PHP_PATH', dirname(__DIR__, 2)); |
| 23 | + } |
| 24 | + |
| 25 | + if (!defined('WEBENTOR_CORE_PUBLIC_PATH')) { |
| 26 | + define('WEBENTOR_CORE_PUBLIC_PATH', WEBENTOR_CORE_PHP_PATH . '/public/build'); |
| 27 | + } |
| 28 | + if (!defined('WEBENTOR_CORE_MANIFEST_PATH')) { |
| 29 | + define('WEBENTOR_CORE_MANIFEST_PATH', WEBENTOR_CORE_PUBLIC_PATH . '/manifest.json'); |
| 30 | + } |
| 31 | + if (!defined('WEBENTOR_CORE_RESOURCES_PATH')) { |
| 32 | + define('WEBENTOR_CORE_RESOURCES_PATH', WEBENTOR_CORE_PHP_PATH . '/resources'); |
| 33 | + } |
| 34 | + if (!defined('WEBENTOR_CORE_VITE_MANIFEST_DIR')) { |
| 35 | + define('WEBENTOR_CORE_VITE_MANIFEST_DIR', WEBENTOR_CORE_PHP_PATH . '/public/build'); |
| 36 | + } |
| 37 | + if (!defined('WEBENTOR_CORE_RESOURCES_DIR')) { |
| 38 | + define('WEBENTOR_CORE_RESOURCES_DIR', WEBENTOR_CORE_PHP_PATH . '/resources'); |
| 39 | + } |
| 40 | + |
| 41 | + if (file_exists($composer = WEBENTOR_CORE_PHP_PATH . '/vendor/autoload.php')) { |
| 42 | + require_once $composer; |
| 43 | + } |
| 44 | + } |
| 45 | + |
15 | 46 | public function boot(): void |
16 | 47 | { |
| 48 | + // Load core app bootstrap files (hook registrations, helpers, CLI). |
| 49 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/acf.php'; |
| 50 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/blocks-init.php'; |
| 51 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/blocks-settings.php'; |
| 52 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/blocks-migration.php'; |
| 53 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/CloudinaryClient.php'; |
| 54 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/i18n.php'; |
| 55 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/images.php'; |
| 56 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/setup-core.php'; |
| 57 | + require_once WEBENTOR_CORE_PHP_PATH . '/app/utils.php'; |
| 58 | + |
17 | 59 | // Register Blade directives |
18 | 60 | Blade::directive('sliderContent', new SliderContentBladeDirective()); |
19 | 61 | Blade::directive('enqueueScripts', new EnqueueScriptsBladeDirective()); |
|
0 commit comments