| 1 |
<?php |
| 2 |
/** |
| 3 |
* Widgets manager |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
namespace WPFunnels\Widgets; |
| 8 |
|
| 9 |
use WPFunnels\Base_Manager; |
| 10 |
use WPFunnels\Traits\SingletonTrait; |
| 11 |
use WPFunnels\Widgets\Gutenberg\BlockTypes\Gutenberg_Editor; |
| 12 |
use WPFunnels\Wpfnl_functions; |
| 13 |
|
| 14 |
class Wpfnl_Widgets_Manager extends Base_Manager |
| 15 |
{ |
| 16 |
|
| 17 |
use SingletonTrait; |
| 18 |
|
| 19 |
private $widgets = []; |
| 20 |
|
| 21 |
public function init() |
| 22 |
{ |
| 23 |
$modules_namespace_prefix = $this->get_namespace_prefix(); |
| 24 |
$builders = $this->get_builders(); |
| 25 |
|
| 26 |
foreach ($builders as $builder) { |
| 27 |
$class_name = str_replace('-', ' ', $builder); |
| 28 |
$class_name = str_replace(' ', '', ucwords($class_name)); |
| 29 |
$class_name = $modules_namespace_prefix . '\\Widgets\\' . $class_name . '\Manager'; |
| 30 |
$this->widgets[$builder] = $class_name::instance(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
public function get_builders() |
| 36 |
{ |
| 37 |
$builder = array( |
| 38 |
'elementor', |
| 39 |
'gutenberg', |
| 40 |
'diviModules', |
| 41 |
); |
| 42 |
$oxygen_capability = Wpfnl_functions::oxygen_builder_version_capability(); |
| 43 |
if ($oxygen_capability){ |
| 44 |
array_push($builder,'oxygen'); |
| 45 |
} |
| 46 |
return apply_filters('wpfunnels/builders',$builder); |
| 47 |
} |
| 48 |
} |
| 49 |
|