1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<?php /** * This file is part of the WooCommerce Email Editor package * * @package Automattic\WooCommerce\EmailEditor */
declare( strict_types = 1 ); namespace Automattic\WooCommerce\EmailEditor;
use Automattic\WooCommerce\EmailEditor\Engine\Email_Editor; use Automattic\WooCommerce\EmailEditor\Integrations\Core\Initializer as CoreEmailEditorIntegration;
/** * Bootstrap class for initializing the Email Editor functionality. */ class Bootstrap {
/** * Email editor instance. * * @var Email_Editor */ private $email_editor;
/** * Core email editor integration instance. * * @var CoreEmailEditorIntegration */ private $core_email_editor_integration;
/** * Constructor. * * @param Email_Editor $email_editor Email editor instance. * @param CoreEmailEditorIntegration $core_email_editor_integration Core email editor integration instance. */ public function __construct( Email_Editor $email_editor, CoreEmailEditorIntegration $core_email_editor_integration ) { $this->email_editor = $email_editor; $this->core_email_editor_integration = $core_email_editor_integration; }
/** * Initialize the email editor functionality. */ public function init(): void { add_action( 'init', array( $this, 'initialize', ) );
add_filter( 'woocommerce_email_editor_initialized', array( $this, 'setup_email_editor_integrations', ) ); add_filter( 'block_type_metadata_settings', array( $this->core_email_editor_integration, 'update_block_settings' ), 10, 1 ); }
/** * Initialize the email editor. */ public function initialize(): void { $this->email_editor->initialize(); }
/** * Setup email editor integrations. */ public function setup_email_editor_integrations(): bool { $this->core_email_editor_integration->initialize(); return true; // PHPStan expect returning a value from the filter. } }
|