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 / settings / module.php

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

50 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings module (spec 015-settings-page).
4 *
5 * The wp-admin Settings submenu page, the settings/update REST endpoint, and the
6 * public-page custom-CSS injection. Relocated from includes/Admin/ — behavior
7 * byte-identical (same submenu, same route, same wp_head output).
8 *
9 * @package Templately
10 */
11
12 namespace Templately\Modules\Settings;
13
14 use Templately\Core\Module_Base;
15 use Templately\Modules\Settings\REST\Preferences as PreferencesEndpoint;
16 use Templately\Modules\Settings\REST\Settings as SettingsEndpoint;
17
18 class Module extends Module_Base {
19
20 public function get_name(): string {
21 return 'settings';
22 }
23
24 public function get_dependencies(): array {
25 // REST/Settings.php calls KitApplier::apply() from modules/elementor-kit-settings
26 // (spec 031) when persisting global colors/typography.
27 return [ 'elementor-kit-settings' ];
28 }
29
30 protected function init_hooks(): void {
31 // Registers admin_menu (Settings submenu) + wp_head (custom CSS) — both hooks
32 // fire after plugins_loaded, so boot-time registration is timing-identical to
33 // the old Plugin-constructor instantiation.
34 Settings::get_instance();
35
36 // Core's Admin::scripts() localizes window.templately; the module contributes
37 // its per-user pref through the existing filter seam (core never imports us).
38 add_filter( 'templately_admin_localized_data', function ( $data ) {
39 $data['editor_default_tab'] = Preferences::get_editor_default_tab();
40
41 return $data;
42 } );
43 }
44
45 public function register_rest_routes(): void {
46 SettingsEndpoint::get_instance()->register_routes();
47 PreferencesEndpoint::get_instance()->register_routes();
48 }
49 }
50