Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| PatternsFeature | |
0.00% |
0 / 19 |
|
0.00% |
0 / 2 |
42 | |
0.00% |
0 / 1 |
| initialize | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
6 | |||
| defineConstants | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace NewfoldLabs\WP\Module\Patterns; |
| 4 | |
| 5 | use NewfoldLabs\WP\ModuleLoader\Container; |
| 6 | |
| 7 | use function NewfoldLabs\WP\ModuleLoader\container as getContainer; |
| 8 | |
| 9 | /** |
| 10 | * Child class for a feature |
| 11 | * |
| 12 | * Child classes should define a name property as the feature name for all API calls. This name will be used in the registry. |
| 13 | * Child class naming convention is {FeatureName}Feature. |
| 14 | */ |
| 15 | class PatternsFeature extends \NewfoldLabs\WP\Module\Features\Feature { |
| 16 | /** |
| 17 | * The feature name. |
| 18 | * |
| 19 | * @var string |
| 20 | */ |
| 21 | protected $name = 'patterns'; |
| 22 | |
| 23 | /** |
| 24 | * The feature value. Defaults to on. |
| 25 | * |
| 26 | * @var boolean |
| 27 | */ |
| 28 | protected $value = true; |
| 29 | |
| 30 | /** |
| 31 | * Initialize staging feature. |
| 32 | */ |
| 33 | public function initialize() { |
| 34 | if ( function_exists( 'add_action' ) ) { |
| 35 | |
| 36 | // Register module |
| 37 | add_action( |
| 38 | 'plugins_loaded', |
| 39 | function () { |
| 40 | $container = getContainer(); |
| 41 | $this->defineConstants( $container ); |
| 42 | new Patterns( $container ); |
| 43 | } |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Define constnats that require container values |
| 50 | * |
| 51 | * @param Container $container The module container instance. |
| 52 | */ |
| 53 | public function defineConstants( Container $container ) { |
| 54 | if ( ! defined( 'NFD_WONDER_BLOCKS_BUILD_URL' ) && defined( 'NFD_WONDER_BLOCKS_VERSION' ) ) { |
| 55 | define( |
| 56 | 'NFD_WONDER_BLOCKS_BUILD_URL', |
| 57 | $container->plugin()->url . 'vendor/newfold-labs/wp-module-patterns/build/' . NFD_WONDER_BLOCKS_VERSION |
| 58 | ); |
| 59 | } |
| 60 | if ( ! defined( 'NFD_WONDER_BLOCKS_URL' ) ) { |
| 61 | define( |
| 62 | 'NFD_WONDER_BLOCKS_URL', |
| 63 | $container->plugin()->url . 'vendor/newfold-labs/wp-module-patterns' |
| 64 | ); |
| 65 | } |
| 66 | } |
| 67 | } |