Merge pull request woocommerce/woocommerce-admin#2070 from woocommerce/fix/bad-merge-2033
Merge pull request woocommerce/woocommerce-admin#2018 from woocommerce/try/extension-build-env
This commit is contained in:
commit
91967ea0dd
|
@ -30,3 +30,20 @@ function add_report_register_script() {
|
||||||
wp_enqueue_script( 'add-report' );
|
wp_enqueue_script( 'add-report' );
|
||||||
}
|
}
|
||||||
add_action( 'admin_enqueue_scripts', 'add_report_register_script' );
|
add_action( 'admin_enqueue_scripts', 'add_report_register_script' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add "Example" as a Analytics submenu item.
|
||||||
|
*
|
||||||
|
* @param array $report_pages Report page menu items.
|
||||||
|
* @return array Updated report page menu items.
|
||||||
|
*/
|
||||||
|
function add_report_add_report_menu_item( $report_pages ) {
|
||||||
|
$report_pages[] = array(
|
||||||
|
'title' => __( 'Example', 'woocommerce-admin' ),
|
||||||
|
'parent' => '/analytics/revenue',
|
||||||
|
'path' => '/analytics/example',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $report_pages;
|
||||||
|
}
|
||||||
|
add_filter( 'woocommerce_admin_report_menu_items', 'add_report_add_report_menu_item' );
|
||||||
|
|
|
@ -83,87 +83,66 @@ class WC_Admin_Analytics {
|
||||||
56 // After WooCommerce & Product menu items.
|
56 // After WooCommerce & Product menu items.
|
||||||
);
|
);
|
||||||
|
|
||||||
wc_admin_register_page(
|
$report_pages = array(
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Revenue', 'woocommerce-admin' ),
|
'title' => __( 'Revenue', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/revenue',
|
'path' => '/analytics/revenue',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Orders', 'woocommerce-admin' ),
|
'title' => __( 'Orders', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/orders',
|
'path' => '/analytics/orders',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Products', 'woocommerce-admin' ),
|
'title' => __( 'Products', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/products',
|
'path' => '/analytics/products',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Categories', 'woocommerce-admin' ),
|
'title' => __( 'Categories', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/categories',
|
'path' => '/analytics/categories',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Coupons', 'woocommerce-admin' ),
|
'title' => __( 'Coupons', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/coupons',
|
'path' => '/analytics/coupons',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Taxes', 'woocommerce-admin' ),
|
'title' => __( 'Taxes', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/taxes',
|
'path' => '/analytics/taxes',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Downloads', 'woocommerce-admin' ),
|
'title' => __( 'Downloads', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/downloads',
|
'path' => '/analytics/downloads',
|
||||||
)
|
),
|
||||||
);
|
'yes' === get_option( 'woocommerce_manage_stock' ) ? array(
|
||||||
|
'title' => __( 'Stock', 'woocommerce-admin' ),
|
||||||
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
|
'parent' => '/analytics/revenue',
|
||||||
wc_admin_register_page(
|
'path' => '/analytics/stock',
|
||||||
array(
|
) : null,
|
||||||
'title' => __( 'Stock', 'woocommerce-admin' ),
|
|
||||||
'parent' => '/analytics/revenue',
|
|
||||||
'path' => '/analytics/stock',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Customers', 'woocommerce-admin' ),
|
'title' => __( 'Customers', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/customers',
|
'path' => '/analytics/customers',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
wc_admin_register_page(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Settings', 'woocommerce-admin' ),
|
'title' => __( 'Settings', 'woocommerce-admin' ),
|
||||||
'parent' => '/analytics/revenue',
|
'parent' => '/analytics/revenue',
|
||||||
'path' => '/analytics/settings',
|
'path' => '/analytics/settings',
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$report_pages = apply_filters( 'woocommerce_admin_report_menu_items', $report_pages );
|
||||||
|
|
||||||
|
foreach ( $report_pages as $report_page ) {
|
||||||
|
if ( ! is_null( $report_page ) ) {
|
||||||
|
wc_admin_register_page( $report_page );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue