| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Library\Documents; |
| 3 |
|
| 4 |
use Elementor\Core\Base\Document; |
| 5 |
use Elementor\Modules\Library\Traits\Library; |
| 6 |
use Elementor\TemplateLibrary\Source_Local; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Elementor library document. |
| 14 |
* |
| 15 |
* Elementor library document handler class is responsible for handling |
| 16 |
* a document of the library type. |
| 17 |
* |
| 18 |
* @since 2.0.0 |
| 19 |
*/ |
| 20 |
abstract class Library_Document extends Document { |
| 21 |
|
| 22 |
// Library Document Trait |
| 23 |
use Library; |
| 24 |
|
| 25 |
/** |
| 26 |
* The taxonomy type slug for the library document. |
| 27 |
*/ |
| 28 |
const TAXONOMY_TYPE_SLUG = 'elementor_library_type'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Get document properties. |
| 32 |
* |
| 33 |
* Retrieve the document properties. |
| 34 |
* |
| 35 |
* @since 2.0.0 |
| 36 |
* @access public |
| 37 |
* @static |
| 38 |
* |
| 39 |
* @return array Document properties. |
| 40 |
*/ |
| 41 |
public static function get_properties() { |
| 42 |
$properties = parent::get_properties(); |
| 43 |
|
| 44 |
$properties['admin_tab_group'] = 'library'; |
| 45 |
$properties['show_in_library'] = true; |
| 46 |
$properties['register_type'] = true; |
| 47 |
$properties['cpt'] = [ Source_Local::CPT ]; |
| 48 |
|
| 49 |
return $properties; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Get initial config. |
| 54 |
* |
| 55 |
* Retrieve the current element initial configuration. |
| 56 |
* |
| 57 |
* Adds more configuration on top of the controls list and the tabs assigned |
| 58 |
* to the control. This method also adds element name, type, icon and more. |
| 59 |
* |
| 60 |
* @since 2.9.0 |
| 61 |
* @access protected |
| 62 |
* |
| 63 |
* @return array The initial config. |
| 64 |
*/ |
| 65 |
public function get_initial_config() { |
| 66 |
$config = parent::get_initial_config(); |
| 67 |
|
| 68 |
$config['library'] = [ |
| 69 |
'save_as_same_type' => true, |
| 70 |
]; |
| 71 |
|
| 72 |
return $config; |
| 73 |
} |
| 74 |
|
| 75 |
public function get_content( $with_css = false ) { |
| 76 |
return do_shortcode( parent::get_content( $with_css ) ); |
| 77 |
} |
| 78 |
} |
| 79 |
|