Skip to content

Conversation

circlecube
Copy link
Member

Proposed changes

This includes a register filter for every feature to self-register. Not sure we still need the is_subclass_of check, but doesn't hurt to have the extra check.

This also includes the update I thought I'd already merged that uses the isEnabled for the js API store.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

* update/features-api-state:
  lint fix
  use isEnabled to load features into localized script
since get_declared_class is proving inconsistent
@circlecube circlecube requested a review from wpscholar May 21, 2024 20:19
@circlecube circlecube self-assigned this May 21, 2024
foreach ( get_declared_classes() as $class ) {
if ( is_subclass_of( $class, 'NewfoldLabs\WP\Module\Features\Feature' ) ) {
// error_log( 'NewfoldLabs\WP\Module\Features child class found: '.$class );
$features = apply_filters( 'newfold/features/filter/register', self::$features );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$features = apply_filters( 'newfold/features/filter/register', self::$features );
$features = apply_filters( 'newfold/features/filter/register', [] );

Comment on lines 28 to 34
/**
* Feature Classes
*
* @var Array
*/
private static $features = array();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Feature Classes
*
* @var Array
*/
private static $features = array();

@circlecube circlecube merged commit e2eb884 into main May 21, 2024
@circlecube circlecube deleted the add/feature-register-filter branch May 21, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants