@sociallane/elements 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sociallane/elements",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Elementor widgets and elements with Tailwind CSS for SocialLane. WordPress plugin.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -61,7 +61,6 @@ class Plugin {
61
61
 
62
62
  add_action( 'elementor/widgets/register', [ $this->widgets_loader, 'register_widgets' ] );
63
63
  add_action( 'elementor/elements/categories_registered', [ $this->widgets_loader, 'register_categories' ] );
64
- Disable_Elementor_Widgets::init();
65
64
 
66
65
  // Disable Elementor and Hello theme reset CSS so Tailwind/base controls the document.
67
66
  Disable_Reset_Css::init();
@@ -127,32 +127,34 @@ foreach ( $slides as $s ) {
127
127
  class="hero-overlay__cta-wrap <?php echo $is_slider ? ( $index === 0 ? '' : ' hidden' ) : ''; ?>"
128
128
  data-slide-index="<?php echo (int) $index; ?>"
129
129
  >
130
- <a
131
- href="<?php echo esc_url( $slide['cta']['url'] ?? '#' ); ?>"
132
- class="<?php echo esc_attr( $view['classes']['cta_bar'] ?? '' ); ?>"
133
- <?php echo ! empty( $slide['cta']['attrs'] ) ? ' ' . $slide['cta']['attrs'] : ''; ?>
134
- >
135
- <span><?php echo $slide['cta']['text']; ?></span>
136
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
137
- <path d="M5 12h14M19 12l-4-4M19 12l-4 4"/>
138
- </svg>
139
- </a>
130
+ <?php
131
+ $button = $slide['cta'];
132
+ $button['class'] = trim( ( $view['classes']['cta_bar'] ?? '' ) . ' ' . ( $button['class'] ?? '' ) );
133
+ if ( empty( $button['icon'] ) ) {
134
+ $button['icon'] = [ 'value' => 'eicon-arrow-right', 'library' => 'eicons' ];
135
+ $button['icon_position'] = 'right';
136
+ }
137
+ include $elements_path . '/button/templates/render.php';
138
+ ?>
140
139
  </div>
141
140
  <?php endif; ?>
142
141
  <?php endforeach; ?>
143
142
  <?php endif; ?>
144
143
  </div>
145
144
  <?php if ( ! empty( $view['anchor_button'] ) ) : ?>
146
- <a
147
- href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
148
- class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
149
- aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
150
- >
151
- <span><?php echo $view['anchor_button']['text']; ?></span>
152
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
153
- <path d="M12 5v14M19 12l-7 7-7-7"/>
154
- </svg>
155
- </a>
145
+ <?php
146
+ $button = [
147
+ 'text' => $view['anchor_button']['text'],
148
+ 'url' => $view['anchor_button']['url'],
149
+ 'variant' => 'ghost',
150
+ 'size' => 'md',
151
+ 'class' => $view['classes']['anchor_btn'] ?? '',
152
+ 'icon' => [ 'value' => 'eicon-chevron-down', 'library' => 'eicons' ],
153
+ 'icon_position' => 'right',
154
+ 'attrs' => 'aria-label="' . esc_attr( $view['anchor_button']['text'] ) . '"',
155
+ ];
156
+ include $elements_path . '/button/templates/render.php';
157
+ ?>
156
158
  <?php endif; ?>
157
159
  </div>
158
160
 
@@ -127,32 +127,34 @@ foreach ( $slides as $s ) {
127
127
  class="hero-overlay__cta-wrap <?php echo $is_slider ? ( $index === 0 ? '' : ' hidden' ) : ''; ?>"
128
128
  data-slide-index="<?php echo (int) $index; ?>"
129
129
  >
130
- <a
131
- href="<?php echo esc_url( $slide['cta']['url'] ?? '#' ); ?>"
132
- class="<?php echo esc_attr( $view['classes']['cta_bar'] ?? '' ); ?>"
133
- <?php echo ! empty( $slide['cta']['attrs'] ) ? ' ' . $slide['cta']['attrs'] : ''; ?>
134
- >
135
- <span><?php echo $slide['cta']['text']; ?></span>
136
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
137
- <path d="M5 12h14M19 12l-4-4M19 12l-4 4"/>
138
- </svg>
139
- </a>
130
+ <?php
131
+ $button = $slide['cta'];
132
+ $button['class'] = trim( ( $view['classes']['cta_bar'] ?? '' ) . ' ' . ( $button['class'] ?? '' ) );
133
+ if ( empty( $button['icon'] ) ) {
134
+ $button['icon'] = [ 'value' => 'eicon-arrow-right', 'library' => 'eicons' ];
135
+ $button['icon_position'] = 'right';
136
+ }
137
+ include $elements_path . '/button/templates/render.php';
138
+ ?>
140
139
  </div>
141
140
  <?php endif; ?>
142
141
  <?php endforeach; ?>
143
142
  <?php endif; ?>
144
143
  </div>
145
144
  <?php if ( ! empty( $view['anchor_button'] ) ) : ?>
146
- <a
147
- href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
148
- class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
149
- aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
150
- >
151
- <span><?php echo $view['anchor_button']['text']; ?></span>
152
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
153
- <path d="M12 5v14M19 12l-7 7-7-7"/>
154
- </svg>
155
- </a>
145
+ <?php
146
+ $button = [
147
+ 'text' => $view['anchor_button']['text'],
148
+ 'url' => $view['anchor_button']['url'],
149
+ 'variant' => 'ghost',
150
+ 'size' => 'md',
151
+ 'class' => $view['classes']['anchor_btn'] ?? '',
152
+ 'icon' => [ 'value' => 'eicon-chevron-down', 'library' => 'eicons' ],
153
+ 'icon_position' => 'right',
154
+ 'attrs' => 'aria-label="' . esc_attr( $view['anchor_button']['text'] ) . '"',
155
+ ];
156
+ include $elements_path . '/button/templates/render.php';
157
+ ?>
156
158
  <?php endif; ?>
157
159
  </div>
158
160
 
@@ -127,32 +127,34 @@ foreach ( $slides as $s ) {
127
127
  class="hero-overlay__cta-wrap <?php echo $is_slider ? ( $index === 0 ? '' : ' hidden' ) : ''; ?>"
128
128
  data-slide-index="<?php echo (int) $index; ?>"
129
129
  >
130
- <a
131
- href="<?php echo esc_url( $slide['cta']['url'] ?? '#' ); ?>"
132
- class="<?php echo esc_attr( $view['classes']['cta_bar'] ?? '' ); ?>"
133
- <?php echo ! empty( $slide['cta']['attrs'] ) ? ' ' . $slide['cta']['attrs'] : ''; ?>
134
- >
135
- <span><?php echo $slide['cta']['text']; ?></span>
136
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
137
- <path d="M5 12h14M19 12l-4-4M19 12l-4 4"/>
138
- </svg>
139
- </a>
130
+ <?php
131
+ $button = $slide['cta'];
132
+ $button['class'] = trim( ( $view['classes']['cta_bar'] ?? '' ) . ' ' . ( $button['class'] ?? '' ) );
133
+ if ( empty( $button['icon'] ) ) {
134
+ $button['icon'] = [ 'value' => 'eicon-arrow-right', 'library' => 'eicons' ];
135
+ $button['icon_position'] = 'right';
136
+ }
137
+ include $elements_path . '/button/templates/render.php';
138
+ ?>
140
139
  </div>
141
140
  <?php endif; ?>
142
141
  <?php endforeach; ?>
143
142
  <?php endif; ?>
144
143
  </div>
145
144
  <?php if ( ! empty( $view['anchor_button'] ) ) : ?>
146
- <a
147
- href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
148
- class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
149
- aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
150
- >
151
- <span><?php echo $view['anchor_button']['text']; ?></span>
152
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
153
- <path d="M12 5v14M19 12l-7 7-7-7"/>
154
- </svg>
155
- </a>
145
+ <?php
146
+ $button = [
147
+ 'text' => $view['anchor_button']['text'],
148
+ 'url' => $view['anchor_button']['url'],
149
+ 'variant' => 'ghost',
150
+ 'size' => 'md',
151
+ 'class' => $view['classes']['anchor_btn'] ?? '',
152
+ 'icon' => [ 'value' => 'eicon-chevron-down', 'library' => 'eicons' ],
153
+ 'icon_position' => 'right',
154
+ 'attrs' => 'aria-label="' . esc_attr( $view['anchor_button']['text'] ) . '"',
155
+ ];
156
+ include $elements_path . '/button/templates/render.php';
157
+ ?>
156
158
  <?php endif; ?>
157
159
  </div>
158
160
 
@@ -82,7 +82,6 @@ function sociallane_elements_init(): void {
82
82
  }
83
83
  require_once SOCIALLANE_ELEMENTS_PATH . 'includes/class-setup-widget-catalog.php';
84
84
  require_once SOCIALLANE_ELEMENTS_PATH . 'includes/class-disable-reset-css.php';
85
- require_once SOCIALLANE_ELEMENTS_PATH . 'includes/class-disable-elementor-widgets.php';
86
85
  require_once SOCIALLANE_ELEMENTS_PATH . 'includes/class-gravity-forms-styles.php';
87
86
  require_once SOCIALLANE_CORE_PATH . 'includes/class-plugin.php';
88
87
 
@@ -127,32 +127,34 @@ foreach ( $slides as $s ) {
127
127
  class="hero-overlay__cta-wrap <?php echo $is_slider ? ( $index === 0 ? '' : ' hidden' ) : ''; ?>"
128
128
  data-slide-index="<?php echo (int) $index; ?>"
129
129
  >
130
- <a
131
- href="<?php echo esc_url( $slide['cta']['url'] ?? '#' ); ?>"
132
- class="<?php echo esc_attr( $view['classes']['cta_bar'] ?? '' ); ?>"
133
- <?php echo ! empty( $slide['cta']['attrs'] ) ? ' ' . $slide['cta']['attrs'] : ''; ?>
134
- >
135
- <span><?php echo $slide['cta']['text']; ?></span>
136
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
137
- <path d="M5 12h14M19 12l-4-4M19 12l-4 4"/>
138
- </svg>
139
- </a>
130
+ <?php
131
+ $button = $slide['cta'];
132
+ $button['class'] = trim( ( $view['classes']['cta_bar'] ?? '' ) . ' ' . ( $button['class'] ?? '' ) );
133
+ if ( empty( $button['icon'] ) ) {
134
+ $button['icon'] = [ 'value' => 'eicon-arrow-right', 'library' => 'eicons' ];
135
+ $button['icon_position'] = 'right';
136
+ }
137
+ include $elements_path . '/button/templates/render.php';
138
+ ?>
140
139
  </div>
141
140
  <?php endif; ?>
142
141
  <?php endforeach; ?>
143
142
  <?php endif; ?>
144
143
  </div>
145
144
  <?php if ( ! empty( $view['anchor_button'] ) ) : ?>
146
- <a
147
- href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
148
- class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
149
- aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
150
- >
151
- <span><?php echo $view['anchor_button']['text']; ?></span>
152
- <svg class="w-5 h-5 shrink-0" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" aria-hidden="true">
153
- <path d="M12 5v14M19 12l-7 7-7-7"/>
154
- </svg>
155
- </a>
145
+ <?php
146
+ $button = [
147
+ 'text' => $view['anchor_button']['text'],
148
+ 'url' => $view['anchor_button']['url'],
149
+ 'variant' => 'ghost',
150
+ 'size' => 'md',
151
+ 'class' => $view['classes']['anchor_btn'] ?? '',
152
+ 'icon' => [ 'value' => 'eicon-chevron-down', 'library' => 'eicons' ],
153
+ 'icon_position' => 'right',
154
+ 'attrs' => 'aria-label="' . esc_attr( $view['anchor_button']['text'] ) . '"',
155
+ ];
156
+ include $elements_path . '/button/templates/render.php';
157
+ ?>
156
158
  <?php endif; ?>
157
159
  </div>
158
160
 
@@ -1,84 +0,0 @@
1
- <?php
2
- /**
3
- * Disable Elementor widgets except Container.
4
- *
5
- * @package SocialLane_Elements
6
- */
7
-
8
- namespace SocialLane\Elements;
9
-
10
- use Elementor\Widgets_Manager;
11
-
12
- if ( ! defined( 'ABSPATH' ) ) {
13
- exit;
14
- }
15
-
16
- /**
17
- * Class Disable_Elementor_Widgets
18
- */
19
- class Disable_Elementor_Widgets {
20
-
21
- /**
22
- * Hook into Elementor widget registration.
23
- */
24
- public static function init(): void {
25
- add_action( 'elementor/widgets/register', [ __CLASS__, 'disable_non_sociallane_widgets' ], 1000 );
26
- }
27
-
28
- /**
29
- * Disable non-container widgets after Elementor has registered all widgets.
30
- *
31
- * Keeps:
32
- * - Container widget (name: container), if present
33
- *
34
- * Optional:
35
- * - define( 'SOCIALLANE_KEEP_SOCIALLANE_WIDGETS', true );
36
- * to keep SocialLane widgets as well.
37
- *
38
- * @param Widgets_Manager $widgets_manager Elementor widgets manager.
39
- */
40
- public static function disable_non_sociallane_widgets( Widgets_Manager $widgets_manager ): void {
41
- // Allow opt-out for edge cases via wp-config.php:
42
- // define( 'SOCIALLANE_DISABLE_ELEMENTOR_WIDGETS', false );
43
- if ( defined( 'SOCIALLANE_DISABLE_ELEMENTOR_WIDGETS' ) && SOCIALLANE_DISABLE_ELEMENTOR_WIDGETS === false ) {
44
- return;
45
- }
46
-
47
- if ( ! method_exists( $widgets_manager, 'get_widget_types' ) ) {
48
- return;
49
- }
50
-
51
- $widget_types = $widgets_manager->get_widget_types();
52
- if ( ! is_array( $widget_types ) ) {
53
- return;
54
- }
55
-
56
- $keep_sociallane = defined( 'SOCIALLANE_KEEP_SOCIALLANE_WIDGETS' ) && SOCIALLANE_KEEP_SOCIALLANE_WIDGETS;
57
-
58
- foreach ( $widget_types as $widget ) {
59
- if ( ! is_object( $widget ) || ! method_exists( $widget, 'get_name' ) ) {
60
- continue;
61
- }
62
-
63
- $widget_name = (string) $widget->get_name();
64
- $widget_class = get_class( $widget );
65
-
66
- $is_container = $widget_name === 'container';
67
- $is_sociallane = $keep_sociallane && str_starts_with( $widget_class, __NAMESPACE__ . '\\' );
68
-
69
- if ( $is_container || $is_sociallane ) {
70
- continue;
71
- }
72
-
73
- if ( method_exists( $widgets_manager, 'unregister' ) ) {
74
- $widgets_manager->unregister( $widget_name );
75
- continue;
76
- }
77
-
78
- // Backward compatibility for older Elementor APIs.
79
- if ( method_exists( $widgets_manager, 'unregister_widget_type' ) ) {
80
- $widgets_manager->unregister_widget_type( $widget_name );
81
- }
82
- }
83
- }
84
- }