Skip to content

Commit

Permalink
[core/builders] added support woocommerce (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgff committed Nov 19, 2018
1 parent 0263a12 commit 266b4ad
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions configs/woocommerce.json
@@ -0,0 +1,8 @@
{
"post_meta_fields": {
"_purchase_note": {}
},
"post_ml_fields": {
"_purchase_note": {}
}
}
38 changes: 38 additions & 0 deletions includes/builders/class-wpglobus-builders.php
Expand Up @@ -33,8 +33,13 @@ class WPGlobus_Builders {
*/
public static function get_addons() {

if ( ! empty( self::$add_on ) ) {
return self::$add_on;
}

self::$add_on['gutenberg'] = array(
'id' => 'gutenberg',
'role' => 'builder',
'supported_min_version' => '4.0.0',
'const' => 'GUTENBERG_VERSION',
'plugin_name' => 'Gutenberg',
Expand All @@ -45,6 +50,7 @@ public static function get_addons() {

self::$add_on['js_composer'] = array(
'id' => 'js_composer',
'role' => 'builder',
'supported_min_version' => '5.4.0',
'const' => 'WPB_VC_VERSION',
'plugin_name' => 'WPBakery Page Builder',
Expand All @@ -55,6 +61,7 @@ public static function get_addons() {

self::$add_on['elementor'] = array(
'id' => 'elementor',
'role' => 'builder',
'supported_min_version' => '2.2.6',
'const' => 'ELEMENTOR_VERSION',
'plugin_name' => 'Elementor',
Expand All @@ -65,6 +72,7 @@ public static function get_addons() {

self::$add_on['yoast_seo'] = array(
'id' => 'yoast_seo',
'role' => 'builder',
'supported_min_version' => '7.7',
'const' => 'WPSEO_VERSION',
'plugin_name' => 'Yoast SEO',
Expand All @@ -73,6 +81,36 @@ public static function get_addons() {
'stage' => 'production',
);

if ( defined('WPGLOBUS_WC_BUILDERS') && WPGLOBUS_WC_BUILDERS ) {

self::$add_on['woocommerce'] = array(
'id' => 'woocommerce',
'role' => 'add-on',
'config_file' => 'woocommerce.json',
'supported_min_version' => '3.5.1',
'const' => 'WC_PLUGIN_FILE',
'plugin_name' => 'WooCommerce',
'plugin_uri' => 'https://woocommerce.com',
'path' => 'woocommerce/woocommerce.php',
'stage' => 'beta',
);

}

/**
self::$add_on['wp-subtitle'] = array(
'id' => 'wp-subtitle',
'role' => 'add-on',
'config_file' => 'wp-subtitle.json',
'supported_min_version' => '3.1',
'const' => 'WPSUBTITLE_DIR',
'plugin_name' => 'WP Subtitle',
'plugin_uri' => 'http://wordpress.org/plugins/wp-subtitle/',
'path' => 'wp-subtitle/wp-subtitle.php',
'stage' => 'production',
);
// */

/**
* self::$add_on['__test'] = array(
* 'id' => '__test',
Expand Down
19 changes: 19 additions & 0 deletions includes/class-wpglobus-config-vendor.php
Expand Up @@ -192,7 +192,26 @@ public static function get_config_files() {
// if ( defined('SITEORIGIN_PANELS_VERSION') ) {
// self::$vendors[] = 'siteorigin-panels.json';
// }

if ( self::$builder->get_id() != '' && self::$builder->is_builder_page() ) {

$addons = WPGlobus_Builders::get_addons();

if ( ! empty($addons) ) {
foreach( $addons as $id=>$addon ) {
if ( 'add-on' == $addon['role'] ) {
if ( ! empty( $addon['const'] ) && defined( $addon['const'] ) ) {
self::$vendors[] = $addon['config_file'];
}
}
}
}

}

/**
* Now handle with config files.
*/
foreach ( self::$vendors as $file ) {

if ( is_readable( $config_plugin_dir . $file ) ) {
Expand Down

0 comments on commit 266b4ad

Please sign in to comment.