From 38b6d257d0a2804a83dedd48a45ea041196726dc Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 24 May 2024 14:05:55 -0400 Subject: [PATCH] add togglable features to script this is used to know if toggles should be displayed/disabled --- includes/Features.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/Features.php b/includes/Features.php index 8b41598..a2bf61b 100644 --- a/includes/Features.php +++ b/includes/Features.php @@ -118,6 +118,7 @@ public static function assets() { 'NewfoldFeatures', array( 'features' => self::getFeatures(), + 'togglable' => self::getToggleableFeatures(), 'restUrl' => esc_url_raw( rest_url() ) . 'newfold-features/v1', ) ); @@ -160,6 +161,19 @@ public static function getFeatures() { return $features; } + /** + * Get All Features and filter states + * + * @return Array list of features and enabled states (key:name value:enabled) + */ + public static function getToggleableFeatures() { + $features = array(); + foreach ( self::getFeatureList() as $feature ) { + $features[ $feature ] = Features::getInstance()->getFeature( $feature )->isTogglable(); + } + return $features; + } + /** * Get feature list *