From e2e1429acdc71da3d8ed16a90fa5c3b1d8687d35 Mon Sep 17 00:00:00 2001 From: Joshua T Flowers Date: Mon, 4 Jan 2021 14:31:14 -0500 Subject: [PATCH] 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 --- plugins/woocommerce-admin/src/Loader.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/src/Loader.php b/plugins/woocommerce-admin/src/Loader.php index b8a0345b952..b5f0b89c5c6 100644 --- a/plugins/woocommerce-admin/src/Loader.php +++ b/plugins/woocommerce-admin/src/Loader.php @@ -263,6 +263,22 @@ class Loader { 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' ), + '
', + '', + '' + ); + } + return apply_filters( 'woocommerce_settings_features', array( @@ -274,9 +290,10 @@ class Loader { ), array( 'title' => __( 'Navigation', 'woocommerce-admin' ), - 'desc' => __( 'Adds the new WooCommerce navigation experience to the dashboard', 'woocommerce-admin' ), + 'desc' => $description . $update_text, 'id' => 'woocommerce_navigation_enabled', 'type' => 'checkbox', + 'class' => $needs_update ? 'disabled' : '', ), array( 'type' => 'sectionend',