PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.8.0
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.8.0
3.8.0 3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 All 112 releases
templately / modules / elementor-integration / module.php

module.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 3.8.0, at modules/elementor-integration/module.php

92 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor editor integration module (spec 032-elementor-integration).
4 *
5 * PARTIAL EXTRACTION (WIP — stopped mid-spec by explicit user instruction,
6 * 2026-07-03): the PHP platform driver + importer are relocated here; the JS
7 * side (react-src/elementor.js entry + react-src/elementor/*.js component
8 * tree, 8 files, zero external imports — confirmed self-contained) and the
9 * webpack entry migration are NOT done yet. `assets/js/` is intentionally
10 * absent. Continue from here: move react-src/elementor.js ->
11 * modules/elementor-integration/assets/js/index.js (or similar) +
12 * react-src/elementor/ -> modules/elementor-integration/assets/js/elementor/
13 * (git mv preserves the directory name so its 8 files' sibling imports need
14 * zero edits — confirmed via grep, none of them import outside their own
15 * directory), fix index.js's `./utils/sharedLibsBootstrap` + SCSS import
16 * paths, add a webpack.config.partial.js using the ORIGINAL entry key
17 * `elementor` (not `modules/elementor-integration` — PRD §1 R2 note: "editor
18 * entry moves (032/033) keep their original key" since Platform/Elementor.php
19 * hardcodes the enqueue as `js/elementor.js`/`css/elementor.css`, not the
20 * modules/*.js auto-discovery glob), remove the old root `elementor:` entry
21 * from webpack.config.js, then run the full standing verification (PHPUnit,
22 * build, Jest, live sandbox check) before marking the PRD checklist item done.
23 *
24 * PHP relocated: includes/Core/Platform/Elementor.php (the platform driver —
25 * create_page/import_in_library/is_eligible/ui_theme/delete/is_kit/
26 * get_saved_templates/register_child_type_filter) + the importer class that
27 * was misplaced in modules/full-site-import/ since spec 025 (its sole
28 * consumer was always Platform/Elementor.php, confirmed via grep — moving it
29 * here alongside its only caller is the correct home, not full-site-import).
30 * Namespace: Templately\Core\Platform\Elementor -> this module's
31 * Platform\Elementor; Templately\Modules\FullSiteImport\Elementor -> this
32 * module's own Elementor (the importer, extends Elementor's Source_Local).
33 *
34 * CRITICAL ORDERING FIX applied during the PHP move: Plugin::platforms() used
35 * to eagerly call Elementor::get_instance() during plugins_loaded — but that
36 * runs BEFORE Modules_Manager::boot() registers this module's autoloader
37 * (plugins_loaded calls platforms() then apis() then Modules_Manager::boot(),
38 * in that fixed order), so leaving the eager call in Plugin.php would fatal
39 * on class-not-found. Elementor's self-registration (which internally calls
40 * Templately\Core\Platform_Registry::get_instance()->add() — the platform-adapter
41 * registry, unrelated to Module_Base/Modules_Manager) now happens from this
42 * module's own init_hooks() instead, which runs during Modules_Manager::boot()
43 * — after the autoloader for this module's namespace is registered.
44 * Confirmed via grep that nothing between platforms()/apis() and
45 * Modules_Manager::boot() eagerly resolves Platform_Registry::get_instance()->active('elementor')
46 * (all such calls happen later, during actual request handling — REST routes,
47 * template rendering — never during the plugins_loaded bootstrap chain), so
48 * this timing shift is safe.
49 *
50 * @package Templately
51 */
52
53 namespace Templately\Modules\ElementorIntegration;
54
55 use Templately\Core\Module_Base;
56 use Templately\Modules\ElementorIntegration\Platform\Elementor;
57
58 class Module extends Module_Base {
59
60 public function get_name(): string {
61 return 'elementor-integration';
62 }
63
64 public function get_dependencies(): array {
65 // create_page()/import_in_library() call ElementorSettingsMerger::merge()
66 // from modules/elementor-kit-settings (spec 031). The importer + platform
67 // driver also use full-site-import's Utils during import (spec 025). The
68 // driver's create_page() constructs theme-builder's TemplateFactory
69 // (Elementor.php) — the same one-directional structural edge
70 // gutenberg-integration declares for its driver.
71 return [ 'elementor-kit-settings', 'full-site-import', 'theme-builder' ];
72 }
73
74 protected function init_hooks(): void {
75 Elementor::get_instance();
76
77 // Inverted from FSI's RunsImport (which used to call into this module
78 // directly — the one remaining FSI→platform-module code reference): every
79 // import slice needs the Pro-promotion child-type filter active BEFORE the
80 // runners touch Elementor documents, and templately_fsi_before_import fires
81 // at exactly the point the inline call used to run. Idempotent (static
82 // guard inside), and a no-op while Elementor is not yet installed — the
83 // Dependencies runner may install it mid-import, and the next slice's
84 // before-import fire picks it up, exactly as the inline check did.
85 add_action( 'templately_fsi_before_import', static function () {
86 if ( class_exists( '\Elementor\Plugin' ) ) {
87 Elementor::register_child_type_filter();
88 }
89 } );
90 }
91 }
92