PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
jetformbuilder / components / admin / page / traits / admin-dashboard-page-trait.php

admin-dashboard-page-trait.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.6, at components/admin/page/traits/admin-dashboard-page-trait.php

84 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace JFB_Components\Admin\Page\Traits;
5
6 use Jet_Form_Builder\Admin\Pages\Actions\Base_Page_Action;
7 use Jet_Form_Builder\Plugin;
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 trait Admin_Dashboard_Page_Trait {
15
16 protected $config = array();
17
18 /**
19 * Page specific assets
20 */
21 public function assets() {
22 wp_enqueue_script( $this->slug() );
23 }
24
25 /**
26 * Page render function
27 */
28 public function render_page() {
29 printf( '<div id="%s"></div>', esc_attr( 'jet-form-builder_page_' . $this->slug() ) );
30 }
31
32 /**
33 * @return Base_Page_Action[]
34 */
35 public function get_actions(): array {
36 return array();
37 }
38
39 public function query_config(): array {
40 if ( ! empty( $this->config ) ) {
41 return $this->config;
42 }
43 $this->config = apply_filters(
44 "jet-form-builder/page-config/{$this->slug()}",
45 $this->page_config(),
46 $this
47 );
48
49 return $this->config;
50 }
51
52 public function base_script_url(): string {
53 return Plugin::instance()->plugin_url( "assets/build/admin/pages/{$this->slug()}.js" );
54 }
55
56 public function render_config() {
57 $config = $this->query_config();
58
59 if ( ! empty( $config ) ) {
60 wp_localize_script( 'cx-vue', 'JetFBPageConfig', $config );
61 }
62 }
63
64 /**
65 * Returns current page url
66 *
67 * @param array $query_args
68 *
69 * @return string
70 */
71 public function admin_url( $query_args = array() ): string {
72 return add_query_arg(
73 array_merge(
74 array(
75 'post_type' => jet_form_builder()->post_type->slug(),
76 ),
77 $query_args
78 ),
79 esc_url_raw( admin_url( 'edit.php' ) )
80 );
81 }
82
83 }
84