Show parent as default back button label (https://github.com/woocommerce/woocommerce-admin/pull/5435)
* Show parent as default back button label * Make back button logic more succinct
This commit is contained in:
parent
fbdce6cd4e
commit
11ebc96fbe
|
@ -106,7 +106,7 @@ const Container = ( { menuItems } ) => {
|
|||
title={ category.title }
|
||||
menu={ category.id }
|
||||
parentMenu={ category.parent }
|
||||
backButtonLabel={ category.backButtonLabel }
|
||||
backButtonLabel={ category.backButtonLabel || null }
|
||||
>
|
||||
{ !! primaryItems.length && (
|
||||
<NavigationGroup>
|
||||
|
|
|
@ -164,10 +164,6 @@ class Menu {
|
|||
'menuId' => 'primary',
|
||||
'isCategory' => true,
|
||||
'parent' => self::DEFAULT_PARENT,
|
||||
'backButtonLabel' => __(
|
||||
'WooCommerce Home',
|
||||
'woocommerce-admin'
|
||||
),
|
||||
'is_top_level' => false,
|
||||
);
|
||||
$menu_item = wp_parse_args( $args, $defaults );
|
||||
|
@ -176,6 +172,10 @@ class Menu {
|
|||
|
||||
if ( true === $menu_item['is_top_level'] ) {
|
||||
$menu_item['parent'] = 'woocommerce';
|
||||
$menu_item['backButtonLabel'] = __(
|
||||
'WooCommerce Home',
|
||||
'woocommerce-admin'
|
||||
);
|
||||
} else {
|
||||
$menu_item['parent'] = 'woocommerce' === $menu_item['parent'] ? self::DEFAULT_PARENT : $menu_item['parent'];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue