| 1 |
<?php |
| 2 |
/** |
| 3 |
* Elementor document type for Woo Builder templates. |
| 4 |
* |
| 5 |
* @package King_Addons |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace King_Addons\Woo_Builder; |
| 9 |
|
| 10 |
use Elementor\Core\DocumentTypes\Post; |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Registers a custom document type for Woo Builder templates. |
| 18 |
*/ |
| 19 |
class Document extends Post |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Document type name. |
| 23 |
* |
| 24 |
* @return string |
| 25 |
*/ |
| 26 |
public static function get_type(): string |
| 27 |
{ |
| 28 |
return 'king-addons-woo-builder'; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Document type title. |
| 33 |
* |
| 34 |
* @return string |
| 35 |
*/ |
| 36 |
public static function get_title(): string |
| 37 |
{ |
| 38 |
return esc_html__('Woo Builder Template', 'king-addons'); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Document properties. |
| 43 |
* |
| 44 |
* @return array<string,mixed> |
| 45 |
*/ |
| 46 |
public static function get_properties(): array |
| 47 |
{ |
| 48 |
$properties = parent::get_properties(); |
| 49 |
|
| 50 |
return array_merge($properties, [ |
| 51 |
'location' => 'woo-builder', |
| 52 |
'support_wp_page_templates' => true, |
| 53 |
'support_site_editor' => false, |
| 54 |
'has_elements' => true, |
| 55 |
'support_kit' => true, |
| 56 |
'cpt' => ['elementor_library'], |
| 57 |
]); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Get the document edit URL. |
| 62 |
* |
| 63 |
* @return string |
| 64 |
*/ |
| 65 |
public function get_edit_url(): string |
| 66 |
{ |
| 67 |
$url = parent::get_edit_url(); |
| 68 |
|
| 69 |
if ($url) { |
| 70 |
$url = add_query_arg('action', 'elementor', $url); |
| 71 |
} |
| 72 |
|
| 73 |
return $url; |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
|