PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.0-beta1
Elementor Website Builder – more than just a page builder v4.1.0-beta1
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 4.1.0-beta2 All 456 releases
← All changes | modules/ai/module.php +49 -0 4.3.3 → 4.1.0-beta1 View file →
@@ -4,8 +4,9 @@
4 4 use Elementor\Controls_Manager;
5 5 use Elementor\Core\Base\Module as BaseModule;
6 6 use Elementor\Core\Common\Modules\Connect\Module as ConnectModule;
7 7 use Elementor\Element_Base;
8 +use Elementor\Modules\Ai\Feature_Intro\Product_Image_Unification_Intro;
8 9 use Elementor\Plugin;
9 10 use Elementor\Core\Utils\Collection;
10 11 use Elementor\Modules\Ai\Connect\Ai;
11 12 use Elementor\User;
@@ -27,8 +28,10 @@
27 28 self::HISTORY_TYPE_CODE,
28 29 self::HISTORY_TYPE_IMAGE,
29 30 self::HISTORY_TYPE_BLOCK,
30 31 ];
32 + const MIN_PAGES_FOR_CREATE_WITH_AI_BANNER = 10;
33 +
31 34 public function get_name() {
32 35 return 'ai';
33 36 }
34 37
@@ -45,8 +48,10 @@
45 48 if ( ! $this->is_ai_enabled() ) {
46 49 return;
47 50 }
48 51
52 + add_filter( 'elementor/core/admin/homescreen', [ $this, 'add_create_with_ai_banner_to_homescreen' ] );
53 +
49 54 add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) {
50 55 $connect_module->register_app( 'ai', Ai::get_class_name() );
51 56 } );
52 57
@@ -119,8 +124,9 @@
119 124 add_action( 'admin_init', [ $this, 'enqueue_ai_products_page_scripts' ] );
120 125 add_action( 'current_screen', [ $this, 'enqueue_ai_single_product_page_scripts' ] );
121 126 add_action( 'wp_ajax_elementor-ai-get-product-images', [ $this, 'get_product_images_ajax' ] );
122 127 add_action( 'wp_ajax_elementor-ai-set-product-images', [ $this, 'set_product_images_ajax' ] );
128 + Product_Image_Unification_Intro::add_hooks();
123 129 }
124 130 }
125 131
126 132 add_action( 'enqueue_block_editor_assets', function() {
@@ -1543,6 +1549,49 @@
1543 1549 }
1544 1550
1545 1551 $product->set_gallery_image_ids( $gallery_image_ids );
1546 1552 $product->save();
1553 + }
1554 +
1555 + private function should_display_create_with_ai_banner() {
1556 + $elementor_pages = new \WP_Query( [
1557 + 'post_type' => 'page',
1558 + 'post_status' => 'publish',
1559 + 'fields' => 'ids',
1560 + 'posts_per_page' => self::MIN_PAGES_FOR_CREATE_WITH_AI_BANNER + 1,
1561 + ] );
1562 +
1563 + if ( $elementor_pages->post_count > self::MIN_PAGES_FOR_CREATE_WITH_AI_BANNER ) {
1564 + return false;
1565 + }
1566 +
1567 + if ( Utils::is_custom_kit_applied() ) {
1568 + return false;
1569 + }
1570 +
1571 + return true;
1572 + }
1573 +
1574 + private function get_create_with_ai_banner_data() {
1575 + return [
1576 + 'title' => 'Create and launch your site faster with AI',
1577 + 'description' => 'Share your vision with our AI Chat and watch as it becomes a brief, sitemap, and wireframes in minutes:',
1578 + 'input_placeholder' => 'Start describing the site you want to create...',
1579 + 'button_title' => 'Create with AI',
1580 + 'button_cta_url' => 'http://planner.elementor.com/chat.html',
1581 + 'background_image' => ELEMENTOR_ASSETS_URL . 'images/app/ai/ai-site-creator-homepage-bg.svg',
1582 + 'utm_source' => 'editor-home',
1583 + 'utm_medium' => 'wp-dash',
1584 + 'utm_campaign' => 'generate-with-ai',
1585 + ];
1586 + }
1587 +
1588 + public function add_create_with_ai_banner_to_homescreen( $home_screen_data ) {
1589 + if ( $this->should_display_create_with_ai_banner() ) {
1590 + $home_screen_data['create_with_ai'] = $this->get_create_with_ai_banner_data();
1591 + } else {
1592 + $home_screen_data['create_with_ai'] = null;
1593 + }
1594 +
1595 + return $home_screen_data;
1547 1596 }
1548 1597 }