PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / promotions / widgets / collection-loop-widget-promotion.php

collection-loop-widget-promotion.php in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at modules/promotions/widgets/collection-loop-widget-promotion.php

64 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Promotions\Widgets;
4
5 use Elementor\Plugin;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10
11 class Collection_Loop_Widget_Promotion {
12
13 private const LOOP_PROMOTION_IMAGE_URL = 'https://assets.elementor.com/packages/v1/images/Loop_grid_promotion.png';
14
15 public function register(): void {
16 add_filter( 'elementor/editor/localize_settings', [ $this, 'add_promotion_data' ] );
17 }
18
19 private function is_active(): bool {
20 return Plugin::$instance->experiments->is_feature_active( 'e_atomic_elements' );
21 }
22
23 public function add_promotion_data( array $settings ): array {
24 if ( ! current_user_can( 'manage_options' ) || ! $this->is_active() ) {
25 return $settings;
26 }
27
28 if ( ! isset( $settings['atomicWidgetPromotions'] ) ) {
29 $settings['atomicWidgetPromotions'] = [];
30 }
31
32 $settings['atomicWidgetPromotions'][] = [
33 'type' => 'collection-loop',
34 'cardType' => 'atomic',
35 'widgets' => $this->get_widgets(),
36 'content' => $this->get_promotion_content(),
37 ];
38
39 return $settings;
40 }
41
42 private function get_widgets(): array {
43 return [
44 [
45 'name' => 'e-collection-loop',
46 'title' => __( 'Loop', 'elementor' ),
47 'icon' => 'eicon-loop-widget',
48 'categories' => '["v4-elements"]',
49 ],
50 ];
51 }
52
53 private function get_promotion_content(): array {
54 return [
55 'title' => __( 'Loop', 'elementor' ),
56 'content' => __( 'Upgrade to connect custom layouts directly to your site database, seamlessly rendering dynamic content queries that engage your site visitors.', 'elementor' ),
57 'ctaText' => __( 'Upgrade now', 'elementor' ),
58 'image' => self::LOOP_PROMOTION_IMAGE_URL,
59 'widgetCtaUrl' => 'https://go.elementor.com/go-pro-loop-modal/',
60 'sectionCtaUrl' => 'https://go.elementor.com/go-pro-loop-section/',
61 ];
62 }
63 }
64