Add link to update WordPress when min version not met (https://github.com/woocommerce/woocommerce-admin/pull/5881)

* Add text to update WP if min version not met

* Add disabled class if needs update
This commit is contained in:
Joshua T Flowers 2021-01-04 14:31:14 -05:00 committed by GitHub
parent f3f6b31a49
commit e2e1429acd
1 changed files with 18 additions and 1 deletions

View File

@ -263,6 +263,22 @@ class Loader {
return $settings; return $settings;
} }
$description = __(
'Adds the new WooCommerce navigation experience to the dashboard',
'woocommerce-admin'
);
$update_text = '';
$needs_update = version_compare( get_bloginfo( 'version' ), '5.6', '<' );
if ( $needs_update && current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
$update_text = sprintf(
/* translators: 1: line break tag, 2: open link to WordPress update link, 3: close link tag. */
__( '%1$s %2$sUpdate WordPress to enable the new navigation%3$s', 'woocommerce-admin' ),
'<br/>',
'<a href="' . self_admin_url( 'update-core.php' ) . '" target="_blank">',
'</a>'
);
}
return apply_filters( return apply_filters(
'woocommerce_settings_features', 'woocommerce_settings_features',
array( array(
@ -274,9 +290,10 @@ class Loader {
), ),
array( array(
'title' => __( 'Navigation', 'woocommerce-admin' ), 'title' => __( 'Navigation', 'woocommerce-admin' ),
'desc' => __( 'Adds the new WooCommerce navigation experience to the dashboard', 'woocommerce-admin' ), 'desc' => $description . $update_text,
'id' => 'woocommerce_navigation_enabled', 'id' => 'woocommerce_navigation_enabled',
'type' => 'checkbox', 'type' => 'checkbox',
'class' => $needs_update ? 'disabled' : '',
), ),
array( array(
'type' => 'sectionend', 'type' => 'sectionend',