PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.0-beta1
Elementor Website Builder – more than just a page builder v3.6.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/container-converter/module.php +2 -40 4.1.0 → 3.6.0-beta1 View file →
@@ -6,9 +6,9 @@
6 6 use Elementor\Controls_Stack;
7 7 use Elementor\Plugin;
8 8
9 9 if ( ! defined( 'ABSPATH' ) ) {
10 - exit; // Exit if accessed directly.
10 + exit; // Exit if accessed directly
11 11 }
12 12
13 13 class Module extends \Elementor\Core\Base\Module {
14 14
@@ -48,22 +48,8 @@
48 48 );
49 49 }
50 50
51 51 /**
52 - * Enqueue the module styles.
53 - *
54 - * @return void
55 - */
56 - public function enqueue_styles() {
57 - wp_enqueue_style(
58 - 'container-converter',
59 - $this->get_css_assets_url( 'modules/container-converter/editor' ),
60 - [],
61 - ELEMENTOR_VERSION
62 - );
63 - }
64 -
65 - /**
66 52 * Add a convert button to sections.
67 53 *
68 54 * @param \Elementor\Controls_Stack $controls_stack
69 55 *
@@ -101,9 +87,9 @@
101 87 *
102 88 * @return void
103 89 */
104 90 protected function add_page_convert_button( Controls_Stack $controls_stack ) {
105 - if ( ! Plugin::$instance->editor->is_edit_mode() || ! $this->page_contains_sections( $controls_stack ) || ! Plugin::$instance->role_manager->user_can( 'design' ) ) {
91 + if ( ! Plugin::$instance->editor->is_edit_mode() ) {
106 92 return;
107 93 }
108 94
109 95 $controls_stack->start_injection( [
@@ -127,31 +113,8 @@
127 113 $controls_stack->end_injection();
128 114 }
129 115
130 116 /**
131 - * Checks if document has any Section elements.
132 - *
133 - * @param \Elementor\Controls_Stack $controls_stack
134 - *
135 - * @return bool
136 - */
137 - protected function page_contains_sections( $controls_stack ) {
138 - $data = $controls_stack->get_elements_data();
139 -
140 - if ( ! is_array( $data ) ) {
141 - return false;
142 - }
143 -
144 - foreach ( $data as $element ) {
145 - if ( isset( $element['elType'] ) && 'section' === $element['elType'] ) {
146 - return true;
147 - }
148 - }
149 -
150 - return false;
151 - }
152 -
153 - /**
154 117 * Initialize the Container-Converter module.
155 118 *
156 119 * @return void
157 120 */
@@ -156,9 +119,8 @@
156 119 * @return void
157 120 */
158 121 public function __construct() {
159 122 add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
160 - add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_styles' ] );
161 123
162 124 add_action( 'elementor/element/section/section_layout/after_section_end', function ( Controls_Stack $controls_stack ) {
163 125 $this->add_section_convert_button( $controls_stack );
164 126 } );