| 1 |
<?php |
| 2 |
/** |
| 3 |
* Divi page builder compatibility |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Class for divi page builder compatibility |
| 10 |
*/ |
| 11 |
class Cartflows_Divi_Compatibility { |
| 12 |
|
| 13 |
/** |
| 14 |
* Member Variable |
| 15 |
* |
| 16 |
* @var instance |
| 17 |
*/ |
| 18 |
private static $instance; |
| 19 |
|
| 20 |
/** |
| 21 |
* Initiator |
| 22 |
*/ |
| 23 |
public static function get_instance() { |
| 24 |
if ( ! isset( self::$instance ) ) { |
| 25 |
self::$instance = new self; |
| 26 |
} |
| 27 |
return self::$instance; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
|
| 35 |
add_filter( 'cartflows_container_atts', array( $this, 'add_id_for_cartflows_container' ) ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Add id attribute to cartflows container which is needed to apply style to divi elements. |
| 40 |
* |
| 41 |
* @param array $atts container HTML attributes. |
| 42 |
* @return array |
| 43 |
*/ |
| 44 |
public function add_id_for_cartflows_container( $atts ) { |
| 45 |
|
| 46 |
$atts['id'] = 'page-container'; |
| 47 |
|
| 48 |
return $atts; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Kicking this off by calling 'get_instance()' method |
| 54 |
*/ |
| 55 |
Cartflows_Divi_Compatibility::get_instance(); |
| 56 |
|