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