| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Modules\Gateways\Pages; |
| 5 |
|
| 6 |
use Jet_Form_Builder\Admin\Pages\interfaces\Page_Script_Declaration_Interface; |
| 7 |
use Jet_Form_Builder\Admin\Pages\Pages_Manager; |
| 8 |
use Jet_Form_Builder\Admin\Single_Pages\Base_Single_Page; |
| 9 |
use Jet_Form_Builder\Admin\Single_Pages\Meta_Containers; |
| 10 |
use Jet_Form_Builder\Exceptions\Repository_Exception; |
| 11 |
use JFB_Modules\Gateways\Meta_Boxes\Payer_Box; |
| 12 |
use JFB_Modules\Gateways\Meta_Boxes\Payer_Shipping_Box; |
| 13 |
use Jet_Form_Builder\Gateways\Meta_Boxes\Payment_Details_Box; |
| 14 |
use JFB_Modules\Gateways\Meta_Boxes\Payment_Actions_Box; |
| 15 |
use JFB_Modules\Gateways\Module; |
| 16 |
|
| 17 |
// If this file is called directly, abort. |
| 18 |
if ( ! defined( 'WPINC' ) ) { |
| 19 |
die; |
| 20 |
} |
| 21 |
|
| 22 |
class Single_Payment_Page extends Base_Single_Page implements Page_Script_Declaration_Interface { |
| 23 |
|
| 24 |
use Gateways_Pages_Trait; |
| 25 |
|
| 26 |
/** |
| 27 |
* Page title |
| 28 |
*/ |
| 29 |
public function title(): string { |
| 30 |
return __( 'JetFormBuilder Payment', 'jet-form-builder' ); |
| 31 |
} |
| 32 |
|
| 33 |
public function parent_slug(): string { |
| 34 |
return Payments_Page::SLUG; |
| 35 |
} |
| 36 |
|
| 37 |
public function meta_containers(): array { |
| 38 |
return array( |
| 39 |
new Meta_Containers\Normal_Meta_Container( |
| 40 |
new Payer_Box(), |
| 41 |
new Payer_Shipping_Box() |
| 42 |
), |
| 43 |
new Meta_Containers\Side_Meta_Container( |
| 44 |
new Payment_Details_Box(), |
| 45 |
new Payment_Actions_Box() |
| 46 |
), |
| 47 |
); |
| 48 |
} |
| 49 |
|
| 50 |
public function assets() { |
| 51 |
wp_enqueue_style( Pages_Manager::STYLE_ADMIN ); |
| 52 |
wp_enqueue_script( Pages_Manager::SCRIPT_VUEX_PACKAGE ); |
| 53 |
|
| 54 |
parent::assets(); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* @throws Repository_Exception |
| 59 |
*/ |
| 60 |
public function register_scripts() { |
| 61 |
/** @var Module $module */ |
| 62 |
/** @noinspection PhpUnhandledExceptionInspection */ |
| 63 |
$module = jet_form_builder()->module( 'gateways' ); |
| 64 |
$script_asset = require_once $module->get_dir( |
| 65 |
'assets/build/admin/pages/jfb-payments-single.asset.php' |
| 66 |
); |
| 67 |
|
| 68 |
wp_register_script( |
| 69 |
$this->slug(), |
| 70 |
$this->base_script_url(), |
| 71 |
$script_asset['dependencies'], |
| 72 |
$script_asset['version'], |
| 73 |
true |
| 74 |
); |
| 75 |
} |
| 76 |
} |
| 77 |
|