| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! interface_exists( 'Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface' ) ) { |
| 4 |
return; |
| 5 |
} |
| 6 |
|
| 7 |
use Automattic\WooCommerce\Blocks\Integrations\IntegrationInterface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Route Protection block integration with WooCommerce Blocks checkout. |
| 11 |
* |
| 12 |
* Enqueues the script that registers the additionalCartCheckoutInnerBlockTypes |
| 13 |
* filter so the Route block is allowed inside checkout inner-block areas. |
| 14 |
*/ |
| 15 |
class Routeapp_Blocks_Integration implements IntegrationInterface { |
| 16 |
|
| 17 |
/** |
| 18 |
* @return string |
| 19 |
*/ |
| 20 |
public function get_name() { |
| 21 |
return 'route-protection'; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Register frontend script that whitelists the block in checkout areas. |
| 26 |
*/ |
| 27 |
public function initialize() { |
| 28 |
wp_register_script( |
| 29 |
'route-protection-block-frontend', |
| 30 |
plugins_url( 'blocks/route-protection/frontend.js', dirname( __FILE__ ) ), |
| 31 |
array(), |
| 32 |
defined( 'ROUTEAPP_VERSION' ) ? ROUTEAPP_VERSION : '1.0.0', |
| 33 |
true |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* @return string[] |
| 39 |
*/ |
| 40 |
public function get_script_handles() { |
| 41 |
return array( 'route-protection-block-frontend' ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @return string[] |
| 46 |
*/ |
| 47 |
public function get_editor_script_handles() { |
| 48 |
return array( 'route-protection-block-frontend' ); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* @return array |
| 53 |
*/ |
| 54 |
public function get_script_data() { |
| 55 |
return array(); |
| 56 |
} |
| 57 |
} |
| 58 |
|