Field.php
1 week ago
FieldInterface.php
1 week ago
Fields.php
1 week ago
FieldsInterface.php
1 week ago
Integrator.php
1 week ago
IntegratorIntegration.php
1 week ago
IntegratorInterface.php
1 week ago
Section.php
1 week ago
SectionInterface.php
1 week ago
Sections.php
1 week ago
SectionsInterface.php
1 week ago
Value.php
1 week ago
ValueInterface.php
1 week ago
IntegratorIntegration.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPDesk\FCF\Free\Integration; |
| 4 | |
| 5 | use FcfVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 6 | use FcfVendor\WPDesk\PluginBuilder\Plugin\HookablePluginDependant; |
| 7 | use FcfVendor\WPDesk\PluginBuilder\Plugin\PluginAccess; |
| 8 | |
| 9 | /** |
| 10 | * . |
| 11 | */ |
| 12 | class IntegratorIntegration implements Hookable, HookablePluginDependant { |
| 13 | |
| 14 | use PluginAccess; |
| 15 | |
| 16 | /** |
| 17 | * Instance of old version main class of plugin. |
| 18 | * |
| 19 | * @var \Flexible_Checkout_Fields_Plugin |
| 20 | */ |
| 21 | private $plugin_old; |
| 22 | |
| 23 | /** |
| 24 | * Class constructor. |
| 25 | * |
| 26 | * @param \Flexible_Checkout_Fields_Plugin $plugin_old Main plugin. |
| 27 | */ |
| 28 | public function __construct( \Flexible_Checkout_Fields_Plugin $plugin_old ) { |
| 29 | $this->plugin_old = $plugin_old; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * {@inheritdoc} |
| 34 | */ |
| 35 | public function hooks() { |
| 36 | add_action( 'init', [ $this, 'set_hook_for_integration' ], 0 ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Initializes integration for 3rd party plugins. |
| 41 | * |
| 42 | * @internal |
| 43 | */ |
| 44 | public function set_hook_for_integration() { |
| 45 | $sections = $this->plugin_old->sections ?? []; |
| 46 | $settings = $this->plugin_old->get_settings(); |
| 47 | |
| 48 | do_action( |
| 49 | 'flexible_checkout_fields/init', |
| 50 | ( new Integrator( $sections, $settings ) ) |
| 51 | ); |
| 52 | } |
| 53 | } |
| 54 |