landing-page.php (2145B)
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 /** 31 * @access public 32 */ 33 public function get_name() { 34 return Landing_Pages_Module::DOCUMENT_TYPE; 35 } 36 37 /** 38 * @access public 39 * @static 40 */ 41 public static function get_title() { 42 return esc_html__( 'Landing Page', 'elementor' ); 43 } 44 45 /** 46 * @access public 47 * @static 48 */ 49 public static function get_plural_title() { 50 return __( 'Landing Pages', 'elementor' ); 51 } 52 53 /** 54 * Save Document. 55 * 56 * Save an Elementor document. 57 * 58 * @since 3.1.0 59 * @access public 60 * 61 * @param $data 62 * 63 * @return bool 64 */ 65 public function save( $data ) { 66 // This is for the first time a Landing Page is created. It is done in order to load a new Landing Page with 67 // 'Canvas' as the default page template. 68 if ( empty( $data['settings']['template'] ) ) { 69 $data['settings']['template'] = Page_Templates_Module::TEMPLATE_CANVAS; 70 } 71 72 return parent::save( $data ); 73 } 74 75 /** 76 * Admin Columns Content 77 * 78 * @since 3.1.0 79 * 80 * @param $column_name 81 * @access public 82 */ 83 public function admin_columns_content( $column_name ) { 84 if ( 'elementor_library_type' === $column_name ) { 85 $this->print_admin_column_type(); 86 } 87 } 88 89 protected function get_remote_library_config() { 90 $config = [ 91 'type' => 'lp', 92 'default_route' => 'templates/landing-pages', 93 'autoImportSettings' => true, 94 ]; 95 96 return array_replace_recursive( parent::get_remote_library_config(), $config ); 97 } 98 }