PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / modules / theme-builder / module.php
auxin-elements / includes / elementor / modules / theme-builder Last commit date
classes 3 years ago module.php 3 years ago theme-page-document.php 1 year ago
module.php
144 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Modules\ThemeBuilder;
3
4 use Elementor\Core\Base\Module AS Module_Base;
5 use Elementor\Core\Base\Document;
6 use Elementor\Elements_Manager;
7 use Auxin\Plugin\CoreElements\Elementor\Modules\ThemeBuilder\Theme_Document as Theme_Document;
8 use Elementor\Plugin;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly
12 }
13
14 class Module extends Module_Base {
15
16 public static function is_preview() {
17 return Plugin::instance()->preview->is_preview_mode() || is_preview();
18 }
19
20 public function get_name() {
21 return 'theme-builder';
22 }
23
24 /**
25 * @return Classes\Preview_Manager
26 */
27 public function get_preview_manager() {
28 return $this->get_component( 'preview' );
29 }
30
31 /**
32 * @param $post_id
33 *
34 * @return Theme_Document
35 */
36 public function get_document( $post_id ) {
37 $document = null;
38
39 try {
40 $document = Plugin::instance()->documents->get( $post_id );
41 } catch ( \Exception $e ) {
42 // Do nothing.
43 unset( $e );
44 }
45
46 // if ( ! empty( $document ) && ! $document instanceof Theme_Document ) {
47 // $document = null;
48 // }
49
50 return $document;
51 }
52
53 public function create_new_dialog_types( $types ) {
54 /**
55 * @var Theme_Document[] $document_types
56 */
57 foreach ( $types as $type => $label ) {
58 $document_type = Plugin::instance()->documents->get_document_type( $type );
59 $instance = new $document_type();
60
61 if ( $instance instanceof Theme_Document && 'section' !== $type ) {
62 $types[ $type ] .= $instance->get_location_label();
63 }
64 }
65
66 return $types;
67 }
68
69 public function print_location_field() {
70 $locations = $this->get_locations_manager()->get_locations( [
71 'public' => true,
72 ] );
73
74 if ( empty( $locations ) ) {
75 return;
76 }
77 ?>
78 <div id="elementor-new-template__form__location__wrapper" class="elementor-form-field">
79 <label for="elementor-new-template__form__location" class="elementor-form-field__label">
80 <?php echo esc_html__( 'Select a Location', 'auxin-elements' ); ?>
81 </label>
82 <div class="elementor-form-field__select__wrapper">
83 <select id="elementor-new-template__form__location" class="elementor-form-field__select" name="meta_location">
84 <option value="">
85 <?php echo esc_html__( 'Select...', 'auxin-elements' ); ?>
86 </option>
87 <?php
88
89 foreach ( $locations as $location => $settings ) {
90 echo sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $location ), esc_html( $settings['label'] ) );
91 }
92 ?>
93 </select>
94 </div>
95 </div>
96 <?php
97 }
98
99 public function print_post_type_field() {
100 $post_types = get_post_types( [
101 'exclude_from_search' => false,
102 ], 'objects' );
103
104 unset( $post_types['product'] );
105
106 if ( empty( $post_types ) ) {
107 return;
108 }
109 ?>
110 <div id="elementor-new-template__form__post-type__wrapper" class="elementor-form-field">
111 <label for="elementor-new-template__form__post-type" class="elementor-form-field__label">
112 <?php echo esc_html__( 'Select Post Type', 'auxin-elements' ); ?>
113 </label>
114 <div class="elementor-form-field__select__wrapper">
115 <select id="elementor-new-template__form__post-type" class="elementor-form-field__select" name="_elementor_template_sub_type">
116 <option value="">
117 <?php echo esc_html__( 'Select', 'auxin-elements' ); ?>...
118 </option>
119 <?php
120
121 foreach ( $post_types as $post_type => $post_type_config ) {
122 $doc_type = Plugin::instance()->documents->get_document_type( $post_type );
123 $doc_name = ( new $doc_type() )->get_name();
124
125 if ( 'post' === $doc_name || 'page' === $doc_name ) {
126 echo sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $post_type ), esc_html( $post_type_config->labels->singular_name ) );
127 }
128 }
129
130 // 404.
131 echo sprintf( '<option value="%1$s">%2$s</option>', 'not_found404', esc_html__( '404 Page', 'auxin-elements' ) );
132
133 ?>
134 </select>
135 </div>
136 </div>
137 <?php
138 }
139
140 public function __construct() {
141 $this->add_component( 'preview', new Classes\Preview_Manager() );
142 }
143 }
144