PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.13
Elementor Website Builder – more than just a page builder v3.0.13
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / library / documents / library-document.php

library-document.php in Elementor Website Builder – more than just a page builder 3.0.13, at modules/library/documents/library-document.php

90 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Library\Documents;
3
4 use Elementor\Core\Base\Document;
5 use Elementor\TemplateLibrary\Source_Local;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly
9 }
10
11 /**
12 * Elementor library document.
13 *
14 * Elementor library document handler class is responsible for handling
15 * a document of the library type.
16 *
17 * @since 2.0.0
18 */
19 abstract class Library_Document extends Document {
20
21 /**
22 * The taxonomy type slug for the library document.
23 */
24 const TAXONOMY_TYPE_SLUG = 'elementor_library_type';
25
26 /**
27 * Get document properties.
28 *
29 * Retrieve the document properties.
30 *
31 * @since 2.0.0
32 * @access public
33 * @static
34 *
35 * @return array Document properties.
36 */
37 public static function get_properties() {
38 $properties = parent::get_properties();
39
40 $properties['admin_tab_group'] = 'library';
41 $properties['show_in_library'] = true;
42 $properties['register_type'] = true;
43
44 return $properties;
45 }
46
47 /**
48 * Get initial config.
49 *
50 * Retrieve the current element initial configuration.
51 *
52 * Adds more configuration on top of the controls list and the tabs assigned
53 * to the control. This method also adds element name, type, icon and more.
54 *
55 * @since 2.9.0
56 * @access protected
57 *
58 * @return array The initial config.
59 */
60 public function get_initial_config() {
61 $config = parent::get_initial_config();
62
63 $config['library'] = [
64 'save_as_same_type' => true,
65 ];
66
67 return $config;
68 }
69
70 public function print_admin_column_type() {
71 $admin_filter_url = admin_url( Source_Local::ADMIN_MENU_SLUG . '&elementor_library_type=' . $this->get_name() );
72
73 printf( '<a href="%s">%s</a>', $admin_filter_url, $this->get_title() );
74 }
75
76 /**
77 * Save document type.
78 *
79 * Set new/updated document type.
80 *
81 * @since 2.0.0
82 * @access public
83 */
84 public function save_template_type() {
85 parent::save_template_type();
86
87 wp_set_object_terms( $this->post->ID, $this->get_name(), self::TAXONOMY_TYPE_SLUG );
88 }
89 }
90