PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / template-parts / components / document.php

document.php in Hello Plus 1.2.0, at modules/template-parts/components/document.php

62 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\TemplateParts\Components;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use Elementor\Core\Documents_Manager;
10 use HelloPlus\Includes\Utils;
11
12 /**
13 * class Document
14 **/
15 class Document {
16
17 public function get_documents_list(): array {
18 return [
19 'Ehp_Header',
20 'Ehp_Footer',
21 ];
22 }
23
24 public function get_documents_namespace(): string {
25 return 'HelloPlus\Modules\TemplateParts\Documents\\';
26 }
27
28 /**
29 * Add Hello+ documents
30 *
31 * @param Documents_Manager $documents_manager
32 *
33 * @return void
34 */
35 public function register( Documents_Manager $documents_manager ) {
36 $documents = $this->get_documents_list();
37 $namespace = $this->get_documents_namespace();
38
39 foreach ( $documents as $document ) {
40 /** @var \HelloPlus\Modules\TemplateParts\Documents\Ehp_Document_Base $doc_class */
41 $doc_class = $namespace . $document;
42
43 // add the doc type to Elementor documents:
44 $documents_manager->register_document_type( $doc_class::get_type(), $doc_class );
45
46 $doc_class::register_hooks();
47 }
48 }
49
50
51 public function register_remote_source() {
52 Utils::elementor()->templates_manager->register_source(
53 'HelloPlus\Modules\TemplateParts\Classes\Sources\Source_Remote_Ehp'
54 );
55 }
56
57 public function __construct() {
58 add_action( 'elementor/documents/register', [ $this, 'register' ] );
59 add_action( 'elementor/init', [ $this, 'register_remote_source' ] );
60 }
61 }
62