PluginProbe
Section Builder with Backgrounds – Customize with Color, Gradient, Image and Parallax. / trunk
Section Builder with Backgrounds – Customize with Color, Gradient, Image and Parallax. vtrunk
trunk 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19
background-block / includes / Admin / Submenu.php

Submenu.php in Section Builder with Backgrounds – Customize with Color, Gradient, Image and Parallax. trunk, at includes/Admin/Submenu.php

46 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace EVBB\Admin;
3
4 if ( !defined( 'ABSPATH' ) ) { exit; }
5
6 if ( !class_exists( 'Submenu' ) ) {
7 class Submenu {
8 public function __construct() {
9 add_action( 'admin_menu', [ $this, 'adminMenu' ] );
10 add_action( 'admin_enqueue_scripts', [ $this, 'adminEnqueueScripts' ] );
11 }
12
13 function adminMenu() {
14 add_submenu_page(
15 'tools.php',
16 'Section Builder with Backgrounds - Plugin Envision',
17 'Section Backgrounds',
18 'manage_options',
19 'background-block',
20 function() {
21 ?>
22 <div id='evbbDashboard' data-info='<?php echo esc_attr( json_encode( [ 'version' => EVBB_VERSION, 'plan' => [ 'name' => 'free' ] ] ) ); ?>'></div>
23 <?php }
24 );
25 }
26
27 function adminEnqueueScripts( $path ){
28 if( strpos( $path, 'background-block' ) !== false ) {
29 wp_enqueue_style( 'evbb-admin-dashboard', EVBB_DIR_URL . 'build/admin/dashboard.css', [], EVBB_VERSION );
30
31 $dependencies = [ 'react', 'react-dom', 'wp-i18n', 'wp-data', 'wp-util' ];
32
33 $asset_file = EVBB_DIR_PATH . 'build/admin/dashboard.asset.php';
34 if ( file_exists( $asset_file ) ) {
35 $asset = require_once $asset_file;
36 $dependencies = array_merge( $asset['dependencies'], [ 'wp-util' ] );
37 }
38
39 wp_enqueue_script( 'evbb-admin-dashboard', EVBB_DIR_URL . 'build/admin/dashboard.js', $dependencies, EVBB_VERSION, true );
40
41 wp_set_script_translations( 'evbb-admin-dashboard', 'background-block', EVBB_DIR_PATH . 'languages' );
42 }
43 }
44 }
45 new Submenu();
46 }