| 1 |
<?php |
| 2 |
/** |
| 3 |
* Divi page builder compatibility class |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WPFunnels\Widgets\DiviModules; |
| 9 |
|
| 10 |
use WPFunnels\Traits\SingletonTrait; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class Wpfnl_Divi_Editor |
| 14 |
* |
| 15 |
* @package WPFunnels\Widgets\DiviModules |
| 16 |
* |
| 17 |
* @since 2.2.6 |
| 18 |
*/ |
| 19 |
class Wpfnl_Divi_Editor { |
| 20 |
|
| 21 |
use SingletonTrait; |
| 22 |
|
| 23 |
public function __construct() { |
| 24 |
$this->divi_compatibility(); |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
private function divi_compatibility() { |
| 29 |
add_filter( 'wpfunnels/page_container_atts', array( $this, 'add_id_to_wpf_page_container' ) ); |
| 30 |
add_filter( 'et_builder_plugin_compat_path_wpfunnels', array( $this, 'register_et_builder_compatibility_class' ), 10, 2 ); |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
/** |
| 35 |
* Add id to wpf page container which is needed. Because divi apply styles |
| 36 |
* to modules based on this id |
| 37 |
* |
| 38 |
* @param $atts |
| 39 |
* |
| 40 |
* @return array |
| 41 |
* |
| 42 |
* @since 2.2.6 |
| 43 |
*/ |
| 44 |
public function add_id_to_wpf_page_container($atts) { |
| 45 |
$atts['id'] = 'page-container'; |
| 46 |
return $atts; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
* Register ET builder compatibility class |
| 52 |
* |
| 53 |
* @param $path |
| 54 |
* @param $plugin_name |
| 55 |
* |
| 56 |
* @return string |
| 57 |
* |
| 58 |
* @since 2.3.4 |
| 59 |
*/ |
| 60 |
public function register_et_builder_compatibility_class( $path, $plugin_name ) { |
| 61 |
if( 'wpfunnels' === $plugin_name ) { |
| 62 |
return WPFNL_DIR . 'includes/core/widgets/divi-modules/classes/class-wpfnl-divi-theme-compatibility.php'; |
| 63 |
} |
| 64 |
return $path; |
| 65 |
} |
| 66 |
} |
| 67 |
|