Skip to content

Commit

Permalink
Merge pull request #8 from newfold-labs/add/togglable-features-to-script
Browse files Browse the repository at this point in the history
Add togglable features to localized script
  • Loading branch information
circlecube authored May 28, 2024
2 parents 31eab6e + 8482240 commit d22ca49
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions includes/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
);
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit d22ca49

Please sign in to comment.