| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Library\Documents; |
| 3 |
|
| 4 |
use Elementor\Core\DocumentTypes\Post; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Elementor page library document. |
| 12 |
* |
| 13 |
* Elementor page library document handler class is responsible for |
| 14 |
* handling a document of a page type. |
| 15 |
* |
| 16 |
* @since 2.0.0 |
| 17 |
*/ |
| 18 |
class Page extends Library_Document { |
| 19 |
|
| 20 |
/** |
| 21 |
* Get document properties. |
| 22 |
* |
| 23 |
* Retrieve the document properties. |
| 24 |
* |
| 25 |
* @since 2.0.0 |
| 26 |
* @access public |
| 27 |
* @static |
| 28 |
* |
| 29 |
* @return array Document properties. |
| 30 |
*/ |
| 31 |
public static function get_properties() { |
| 32 |
$properties = parent::get_properties(); |
| 33 |
|
| 34 |
$properties['support_wp_page_templates'] = true; |
| 35 |
$properties['support_kit'] = true; |
| 36 |
$properties['show_in_finder'] = true; |
| 37 |
|
| 38 |
return $properties; |
| 39 |
} |
| 40 |
|
| 41 |
public static function get_type() { |
| 42 |
return 'page'; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Get document title. |
| 47 |
* |
| 48 |
* Retrieve the document title. |
| 49 |
* |
| 50 |
* @since 2.0.0 |
| 51 |
* @access public |
| 52 |
* @static |
| 53 |
* |
| 54 |
* @return string Document title. |
| 55 |
*/ |
| 56 |
public static function get_title() { |
| 57 |
return esc_html__( 'Page', 'elementor' ); |
| 58 |
} |
| 59 |
|
| 60 |
public static function get_plural_title() { |
| 61 |
return esc_html__( 'Pages', 'elementor' ); |
| 62 |
} |
| 63 |
|
| 64 |
public static function get_add_new_title() { |
| 65 |
return esc_html__( 'Add New Library Page', 'elementor' ); |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* @since 2.1.3 |
| 70 |
* @access public |
| 71 |
*/ |
| 72 |
public function get_css_wrapper_selector() { |
| 73 |
return 'body.elementor-page-' . $this->get_main_id(); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* @since 3.1.0 |
| 78 |
* @access protected |
| 79 |
*/ |
| 80 |
protected function register_controls() { |
| 81 |
parent::register_controls(); |
| 82 |
|
| 83 |
Post::register_hide_title_control( $this ); |
| 84 |
|
| 85 |
Post::register_style_controls( $this ); |
| 86 |
} |
| 87 |
|
| 88 |
protected function get_remote_library_config() { |
| 89 |
$config = parent::get_remote_library_config(); |
| 90 |
|
| 91 |
$config['type'] = 'page'; |
| 92 |
$config['default_route'] = 'templates/pages'; |
| 93 |
|
| 94 |
return $config; |
| 95 |
} |
| 96 |
} |
| 97 |
|