Skip to content

Commit 8fe7016

Browse files
author
moon
committed
Add HelloWorld admin menu
1 parent c5becc5 commit 8fe7016

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

class-wc-calypso-bridge.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public function includes() {
131131
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-free-trial-store-details-task.php';
132132
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-product-import-fix.php';
133133
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-skip-obw.php';
134+
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/class-wc-calypso-bridge-helloword-wc-react-page.php';
134135

135136
// Experiments.
136137
require_once WC_CALYPSO_BRIDGE_PLUGIN_PATH . '/includes/experiments/class-wc-calypso-bridge-task-list-reminderbar-experiment.php';
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
defined( 'ABSPATH' ) || exit;
3+
4+
/**
5+
* WC_Calypso_Bridge_HelloWorld_WC_React_Page Class.
6+
*/
7+
class WC_Calypso_Bridge_HelloWorld_WC_React_Page {
8+
9+
/**
10+
* Class instance.
11+
*/
12+
protected static $instance = false;
13+
14+
/**
15+
* Get class instance.
16+
*/
17+
final public static function get_instance() {
18+
if ( ! self::$instance ) {
19+
self::$instance = new self();
20+
}
21+
22+
return self::$instance;
23+
}
24+
25+
/**
26+
* Constructor.
27+
*/
28+
protected function __construct() {
29+
add_action( 'admin_menu', array($this, 'add_menu_page'));
30+
}
31+
32+
/**
33+
* Initialize hooks.
34+
*/
35+
public function add_menu_page() {
36+
wc_admin_register_page(
37+
array(
38+
'id' => 'woocommerce-wccom-helloworld',
39+
'title' => __('Hello World', 'wc-calyso-bridge'),
40+
'nav_args' => array(
41+
'title' => __( 'Hello World', 'wc-calyso-bridge' ),
42+
),
43+
'path'=> '/hello-world',
44+
'position' => 65,
45+
'icon'=>'dashicons-admin-site',
46+
'capability' => 'manage_options',
47+
)
48+
);
49+
}
50+
}
51+
52+
WC_Calypso_Bridge_HelloWorld_WC_React_Page::get_instance();

0 commit comments

Comments
 (0)