PluginProbe
Sight – Professional Image Gallery and Portfolio / 1.1.0
Sight – Professional Image Gallery and Portfolio v1.1.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8
sight / elementor / control-custom-post.php

control-custom-post.php in Sight – Professional Image Gallery and Portfolio 1.1.0, at elementor/control-custom-post.php

95 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Control Custom Post.
4 *
5 * @package Sight
6 */
7
8 namespace Sight_Elementor\Controls;
9
10 use Elementor\Base_Data_Control;
11
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 /**
18 * Elementor Control
19 *
20 * @since 1.0.0
21 */
22 class Sight_Control_Custom_Post extends Base_Data_Control {
23
24 /**
25 * Retrieve the control type.
26 *
27 * @return string Control type.
28 */
29 public function get_type() {
30 return 'custom_post';
31 }
32
33 /**
34 * Retrieve the default settings.
35 *
36 * @return string Default settings.
37 */
38 protected function get_default_settings() {
39 return array(
40 'label' => esc_html__( 'Custom Post', 'sight' ),
41 'label_block' => true,
42 );
43 }
44
45 /**
46 * Render field control output in the editor.
47 */
48 public function content_template() {
49 $control_uid = $this->get_control_uid();
50 ?>
51 <div class="elementor-control-field">
52 <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
53
54 <div class="elementor-control-input-wrapper">
55 <select name="eae-file-link" class="elementor-control-tag-area" title="{{ data.title }}" data-setting="{{ data.name }}" id="<?php echo esc_attr( $control_uid ); ?>">
56 <# if ( data.controlValue ) { #>
57 <option value="{{ data.controlValue }}" selected="selected">{{{ data.controlValue }}}</div>
58 <# } #>
59 </select>
60 </div>
61 </div>
62 <?php
63
64 }
65
66 /**
67 * Enqueue control scripts and styles.
68 *
69 * Used to register and enqueue custom scripts and styles used by the control.
70 */
71 public function enqueue() {
72 wp_enqueue_style( 'elementor-select2' );
73
74 wp_enqueue_script( 'jquery-elementor-select2' );
75
76 wp_register_script(
77 'custom_post',
78 SIGHT_URL . 'elementor/assets/custom-post.js',
79 array( 'jquery', 'jquery-elementor-select2' ),
80 filemtime( SIGHT_PATH . 'elementor/assets/custom-post.js' ),
81 true
82 );
83
84 wp_localize_script(
85 'custom_post',
86 'cpConfig',
87 array(
88 'ajaxurl' => admin_url( 'admin-ajax.php' ),
89 )
90 );
91
92 wp_enqueue_script( 'custom_post' );
93 }
94 }
95