| 1 |
<?php |
| 2 |
namespace Elementor\Modules\LandingPages\Documents; |
| 3 |
|
| 4 |
use Elementor\Core\DocumentTypes\PageBase; |
| 5 |
use Elementor\Modules\LandingPages\Module as Landing_Pages_Module; |
| 6 |
use Elementor\Modules\Library\Traits\Library; |
| 7 |
use Elementor\Modules\PageTemplates\Module as Page_Templates_Module; |
| 8 |
use Elementor\Plugin; |
| 9 |
use Elementor\TemplateLibrary\Source_Local; |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
class Landing_Page extends PageBase { |
| 16 |
|
| 17 |
// Library Document Trait |
| 18 |
use Library; |
| 19 |
|
| 20 |
public static function get_properties() { |
| 21 |
$properties = parent::get_properties(); |
| 22 |
|
| 23 |
$properties['support_kit'] = true; |
| 24 |
$properties['show_in_library'] = true; |
| 25 |
$properties['cpt'] = [ Landing_Pages_Module::CPT ]; |
| 26 |
|
| 27 |
return $properties; |
| 28 |
} |
| 29 |
|
| 30 |
public static function get_type() { |
| 31 |
return Landing_Pages_Module::DOCUMENT_TYPE; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* @access public |
| 36 |
*/ |
| 37 |
public function get_name() { |
| 38 |
return Landing_Pages_Module::DOCUMENT_TYPE; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* @access public |
| 43 |
* @static |
| 44 |
*/ |
| 45 |
public static function get_title() { |
| 46 |
return esc_html__( 'Landing Page', 'elementor' ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* @access public |
| 51 |
* @static |
| 52 |
*/ |
| 53 |
public static function get_plural_title() { |
| 54 |
return esc_html__( 'Landing Pages', 'elementor' ); |
| 55 |
} |
| 56 |
|
| 57 |
public static function get_create_url() { |
| 58 |
return parent::get_create_url() . '#library'; |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Save Document. |
| 63 |
* |
| 64 |
* Save an Elementor document. |
| 65 |
* |
| 66 |
* @since 3.1.0 |
| 67 |
* @access public |
| 68 |
* |
| 69 |
* @param $data |
| 70 |
* |
| 71 |
* @return bool |
| 72 |
*/ |
| 73 |
public function save( $data ) { |
| 74 |
// This is for the first time a Landing Page is created. It is done in order to load a new Landing Page with |
| 75 |
// 'Canvas' as the default page template. |
| 76 |
if ( empty( $data['settings']['template'] ) ) { |
| 77 |
$data['settings']['template'] = Page_Templates_Module::TEMPLATE_CANVAS; |
| 78 |
} |
| 79 |
|
| 80 |
return parent::save( $data ); |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* Admin Columns Content |
| 85 |
* |
| 86 |
* @since 3.1.0 |
| 87 |
* |
| 88 |
* @param $column_name |
| 89 |
* @access public |
| 90 |
*/ |
| 91 |
public function admin_columns_content( $column_name ) { |
| 92 |
if ( 'elementor_library_type' === $column_name ) { |
| 93 |
$this->print_admin_column_type(); |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
protected function get_remote_library_config() { |
| 98 |
$config = [ |
| 99 |
'type' => 'lp', |
| 100 |
'default_route' => 'templates/landing-pages', |
| 101 |
'autoImportSettings' => true, |
| 102 |
]; |
| 103 |
|
| 104 |
return array_replace_recursive( parent::get_remote_library_config(), $config ); |
| 105 |
} |
| 106 |
} |
| 107 |
|