Make the debug tools page entries for attribute filtering hidden by default.
To show the entries the following needs to be run: wc_get_container() ->get(\Automattic\WooCommerce\Internal\ProductAttributesLookup\LookupDataStore::class) ->show_feature();
This commit is contained in:
parent
cdc55bf846
commit
eb2e67d17d
|
@ -271,6 +271,10 @@ CREATE TABLE ' . $this->lookup_table_name . '(
|
||||||
* @return array The tools array with the entry added.
|
* @return array The tools array with the entry added.
|
||||||
*/
|
*/
|
||||||
private function add_initiate_regeneration_entry_to_tools_array( array $tools_array ) {
|
private function add_initiate_regeneration_entry_to_tools_array( array $tools_array ) {
|
||||||
|
if ( ! $this->data_store->is_feature_visible() ) {
|
||||||
|
return $tools_array;
|
||||||
|
}
|
||||||
|
|
||||||
$lookup_table_exists = $this->lookup_table_exists();
|
$lookup_table_exists = $this->lookup_table_exists();
|
||||||
$generation_is_in_progress = $this->regeneration_is_in_progress();
|
$generation_is_in_progress = $this->regeneration_is_in_progress();
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,43 @@ class LookupDataStore {
|
||||||
private $lookup_table_name;
|
private $lookup_table_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LookupDataStore constructor.
|
* Is the feature visible?
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $is_feature_visible;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LookupDataStore constructor. Makes the feature hidden by default.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$this->lookup_table_name = $wpdb->prefix . 'wc_product_attributes_lookup';
|
$this->lookup_table_name = $wpdb->prefix . 'wc_product_attributes_lookup';
|
||||||
|
$this->is_feature_visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the feature is visible (so that dedicated entries will be added to the debug tools page).
|
||||||
|
*
|
||||||
|
* @return bool True if the feature is visible.
|
||||||
|
*/
|
||||||
|
public function is_feature_visible() {
|
||||||
|
return $this->is_feature_visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the feature visible, so that dedicated entries will be added to the debug tools page.
|
||||||
|
*/
|
||||||
|
public function show_feature() {
|
||||||
|
$this->is_feature_visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the feature, so that no entries will be added to the debug tools page.
|
||||||
|
*/
|
||||||
|
public function hide_feature() {
|
||||||
|
$this->is_feature_visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue