1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?php
defined( 'ABSPATH' ) || exit();
class WC_Braintree_Admin_Menus {
public static function init() {
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ), 10 );
add_action( 'admin_menu', array( __CLASS__, 'sub_menu' ), 20 );
add_action( 'admin_menu', array( __CLASS__, 'remove_submenu' ), 30 );
}
public static function admin_menu() {
add_menu_page( __( 'Braintree Gateway', 'woo-payment-gateway' ), __( 'Braintree Gateway', 'woo-payment-gateway' ), 'administrator', 'wc_braintree', null, null, '7.258' );
}
public static function sub_menu() {
add_submenu_page( 'wc_braintree', __( 'Settings', 'woo-payment-gateway' ), __( 'Settings', 'woo-payment-gateway' ), 'manage_woocommerce', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=braintree_api' ) );
add_submenu_page( 'wc_braintree', __( 'Logs', 'woo-payment-gateway' ), __( 'Logs', 'woo-payment-gateway' ), 'manage_woocommerce', admin_url( 'admin.php?page=wc-status&tab=logs' ) );
add_submenu_page(
'wc_braintree',
__( 'Data Migration', 'woo-payment-gateway' ),
__( 'Data Migration', 'woo-payment-gateway' ),
'manage_woocommerce',
'wc-braintree-data-migration',
array(
__CLASS__,
'data_migration_page',
)
);
add_submenu_page( 'wc_braintree', __( 'Documentation', 'woo-payment-gateway' ), __( 'Documentation', 'woo-payment-gateway' ), 'manage_woocommerce', 'https://docs.paymentplugins.com/wc-braintree/config' );
}
public static function remove_submenu() {
global $submenu;
if ( isset( $submenu['wc_braintree'] ) ) {
unset( $submenu['wc_braintree'][0] );
}
}
public static function data_migration_page() {
include 'views/html-data-migration.php';
}
}
WC_Braintree_Admin_Menus::init();