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:
Paul Sealock 2019-04-17 15:41:43 +12:00 committed by GitHub
commit 91967ea0dd
2 changed files with 40 additions and 44 deletions

View File

@ -30,3 +30,20 @@ function add_report_register_script() {
wp_enqueue_script( 'add-report' );
}
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' );

View File

@ -83,87 +83,66 @@ class WC_Admin_Analytics {
56 // After WooCommerce & Product menu items.
);
wc_admin_register_page(
$report_pages = array(
array(
'title' => __( 'Revenue', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/revenue',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Orders', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/orders',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Products', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/products',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Categories', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/categories',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Coupons', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/coupons',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Taxes', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/taxes',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Downloads', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/downloads',
)
);
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
wc_admin_register_page(
array(
'title' => __( 'Stock', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/stock',
)
);
}
wc_admin_register_page(
),
'yes' === get_option( 'woocommerce_manage_stock' ) ? array(
'title' => __( 'Stock', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/stock',
) : null,
array(
'title' => __( 'Customers', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'path' => '/analytics/customers',
)
);
wc_admin_register_page(
),
array(
'title' => __( 'Settings', 'woocommerce-admin' ),
'parent' => '/analytics/revenue',
'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 );
}
}
}
}