| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Checklist\Steps; |
| 4 |
|
| 5 |
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 6 |
use Elementor\Utils; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
class Setup_Header extends Step_Base { |
| 13 |
const STEP_ID = 'setup_header'; |
| 14 |
|
| 15 |
public function __construct( $module, $wordpress_adapter = null, $elementor_adapter = null, $should_promote = true ) { |
| 16 |
$promotion_data = $should_promote |
| 17 |
? $this->render_promotion() |
| 18 |
: null; |
| 19 |
|
| 20 |
parent::__construct( $module, $wordpress_adapter, $elementor_adapter, $promotion_data ); |
| 21 |
} |
| 22 |
|
| 23 |
public function get_id(): string { |
| 24 |
return self::STEP_ID; |
| 25 |
} |
| 26 |
|
| 27 |
public function is_visible(): bool { |
| 28 |
if ( Utils::has_pro() ) { |
| 29 |
return false; |
| 30 |
} |
| 31 |
|
| 32 |
return parent::is_visible(); |
| 33 |
} |
| 34 |
|
| 35 |
public function is_absolute_completed(): bool { |
| 36 |
$args = [ |
| 37 |
'post_type' => 'elementor_library', |
| 38 |
'meta_query' => [ |
| 39 |
'relation' => 'AND', |
| 40 |
[ |
| 41 |
'key' => '_elementor_template_type', |
| 42 |
'value' => 'header', |
| 43 |
'compare' => '=', |
| 44 |
], |
| 45 |
[ |
| 46 |
'key' => '_elementor_conditions', |
| 47 |
], |
| 48 |
], |
| 49 |
'posts_per_page' => 1, |
| 50 |
'fields' => 'ids', |
| 51 |
'no_found_rows' => true, |
| 52 |
'update_post_term_cache' => false, |
| 53 |
'update_post_meta_cache' => false, |
| 54 |
]; |
| 55 |
$query = $this->wordpress_adapter->get_query( $args ); |
| 56 |
$header_templates = $query->posts ?? []; |
| 57 |
|
| 58 |
return count( $header_templates ) >= 1; |
| 59 |
} |
| 60 |
|
| 61 |
public function get_title(): string { |
| 62 |
return esc_html__( 'Set up a header', 'elementor' ); |
| 63 |
} |
| 64 |
|
| 65 |
public function get_description(): string { |
| 66 |
return esc_html__( 'This element applies across different pages, so visitors can easily navigate around your site.', 'elementor' ); |
| 67 |
} |
| 68 |
|
| 69 |
public function get_cta_text(): string { |
| 70 |
return esc_html__( 'Add a header', 'elementor' ); |
| 71 |
} |
| 72 |
|
| 73 |
public function get_cta_url(): string { |
| 74 |
return ''; |
| 75 |
} |
| 76 |
|
| 77 |
public function get_image_src(): string { |
| 78 |
return 'https://assets.elementor.com/checklist/v1/images/checklist-step-4.jpg'; |
| 79 |
} |
| 80 |
|
| 81 |
public function get_is_completion_immutable(): bool { |
| 82 |
return false; |
| 83 |
} |
| 84 |
|
| 85 |
public function get_learn_more_url(): string { |
| 86 |
return 'https://go.elementor.com/app-website-checklist-header-article'; |
| 87 |
} |
| 88 |
|
| 89 |
private function render_promotion() { |
| 90 |
return Filtered_Promotions_Manager::get_filtered_promotion_data( |
| 91 |
[ |
| 92 |
'url' => 'https://go.elementor.com/go-pro-website-checklist-header', |
| 93 |
'text' => esc_html__( 'Upgrade Now', 'elementor' ), |
| 94 |
'icon' => 'default', |
| 95 |
], |
| 96 |
'elementor/checklist/promotion', |
| 97 |
'upgrade_url' |
| 98 |
); |
| 99 |
} |
| 100 |
} |
| 101 |
|