library-document.php (1552B)
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 48 return $properties; 49 } 50 51 /** 52 * Get initial config. 53 * 54 * Retrieve the current element initial configuration. 55 * 56 * Adds more configuration on top of the controls list and the tabs assigned 57 * to the control. This method also adds element name, type, icon and more. 58 * 59 * @since 2.9.0 60 * @access protected 61 * 62 * @return array The initial config. 63 */ 64 public function get_initial_config() { 65 $config = parent::get_initial_config(); 66 67 $config['library'] = [ 68 'save_as_same_type' => true, 69 ]; 70 71 return $config; 72 } 73 }