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>
|
||||
|
|
|
@ -156,26 +156,26 @@ class Menu {
|
|||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => '',
|
||||
'title' => '',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'order' => 100,
|
||||
'migrate' => true,
|
||||
'menuId' => 'primary',
|
||||
'isCategory' => true,
|
||||
'parent' => self::DEFAULT_PARENT,
|
||||
'backButtonLabel' => __(
|
||||
'WooCommerce Home',
|
||||
'woocommerce-admin'
|
||||
),
|
||||
'is_top_level' => false,
|
||||
'id' => '',
|
||||
'title' => '',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'order' => 100,
|
||||
'migrate' => true,
|
||||
'menuId' => 'primary',
|
||||
'isCategory' => true,
|
||||
'parent' => self::DEFAULT_PARENT,
|
||||
'is_top_level' => false,
|
||||
);
|
||||
$menu_item = wp_parse_args( $args, $defaults );
|
||||
$menu_item['title'] = wp_strip_all_tags( wp_specialchars_decode( $menu_item['title'] ) );
|
||||
unset( $menu_item['url'] );
|
||||
|
||||
if ( true === $menu_item['is_top_level'] ) {
|
||||
$menu_item['parent'] = 'woocommerce';
|
||||
$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