-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add staging feature class and move module registration into it
- Loading branch information
1 parent
c464472
commit 46cdb73
Showing
2 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace NewfoldLabs\WP\Module\Staging; | ||
|
||
use NewfoldLabs\WP\ModuleLoader\Container; | ||
use NewfoldLabs\WP\Module\Staging\Staging; | ||
use function NewfoldLabs\WP\ModuleLoader\register; | ||
|
||
/** | ||
* Child class for a feature | ||
* | ||
* Child classes should define a name property as the feature name for all API calls. This name will be used in the registry. | ||
* Child class naming convention is {FeatureName}Feature. | ||
*/ | ||
class StagingFeature extends \NewfoldLabs\WP\Module\Features\Feature { | ||
/** | ||
* The feature name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'staging'; | ||
protected $value = true; // default to on | ||
|
||
/** | ||
* Initialize staging feature | ||
* | ||
*/ | ||
public function initialize() { | ||
if ( function_exists( 'add_action' ) ) { | ||
|
||
add_action( | ||
'plugins_loaded', | ||
function () { | ||
|
||
register( | ||
array( | ||
'name' => 'staging', | ||
'label' => __( 'Staging', 'newfold-staging-module' ), | ||
'callback' => function ( Container $container ) { | ||
return new Staging( $container ); | ||
}, | ||
'isActive' => true, | ||
'isHidden' => true, | ||
) | ||
); | ||
|
||
} | ||
); | ||
|
||
} | ||
} | ||
|
||
} |