module.php
59 lines
| 1 | <?php |
| 2 | namespace Elementor\Modules\Library; |
| 3 | |
| 4 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | use Elementor\Modules\Library\Documents; |
| 6 | use Elementor\Plugin; |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; // Exit if accessed directly. |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Elementor library module. |
| 14 | * |
| 15 | * Elementor library module handler class is responsible for registering and |
| 16 | * managing Elementor library modules. |
| 17 | * |
| 18 | * @since 2.0.0 |
| 19 | */ |
| 20 | class Module extends BaseModule { |
| 21 | |
| 22 | /** |
| 23 | * Get module name. |
| 24 | * |
| 25 | * Retrieve the library module name. |
| 26 | * |
| 27 | * @since 2.0.0 |
| 28 | * @access public |
| 29 | * |
| 30 | * @return string Module name. |
| 31 | */ |
| 32 | public function get_name() { |
| 33 | return 'library'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Library module constructor. |
| 38 | * |
| 39 | * Initializing Elementor library module. |
| 40 | * |
| 41 | * @since 2.0.0 |
| 42 | * @access public |
| 43 | */ |
| 44 | public function __construct() { |
| 45 | Plugin::$instance->documents |
| 46 | ->register_document_type( 'not-supported', Documents\Not_Supported::get_class_full_name() ) |
| 47 | ->register_document_type( 'page', Documents\Page::get_class_full_name() ) |
| 48 | ->register_document_type( 'section', Documents\Section::get_class_full_name() ); |
| 49 | |
| 50 | $experiments_manager = Plugin::$instance->experiments; |
| 51 | |
| 52 | // Register `Container` document type only if the experiment is active. |
| 53 | if ( $experiments_manager->is_feature_active( 'container' ) ) { |
| 54 | Plugin::$instance->documents |
| 55 | ->register_document_type( 'container', Documents\Container::get_class_full_name() ); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 |