1: <?php
2: /**
3: * Elementor Property Inspection Widget
4: *
5: * @package EPL
6: * @subpackage PageBuilders/Elementor/Widgets/Elements
7: * @since 3.6.0
8: */
9:
10: // Exit if accessed directly.
11: if ( ! defined( 'ABSPATH' ) ) {
12: exit;
13: }
14:
15: /**
16: * EPL_Elementor_Property_Inspection Class
17: *
18: * @since 3.6.0
19: */
20: class EPL_Elementor_Property_Inspection extends \Elementor\Widget_Base {
21: use EPL_Elementor_Dynamic_Widget;
22:
23: /**
24: * Get widget name.
25: *
26: * @return string
27: * @since 3.6.0 New: Elementor widgets (beta).
28: */
29: public function get_name() {
30: return 'epl-property-inspection';
31: }
32:
33: /**
34: * Get widget title.
35: *
36: * @return string
37: * @since 3.6.0 New: Elementor widgets (beta).
38: */
39: public function get_title() {
40: return esc_html__( 'Inspection Times', 'easy-property-listings' );
41: }
42:
43: /**
44: * Get widget icon.
45: *
46: * @return string
47: * @since 3.6.0 New: Elementor widgets (beta).
48: */
49: public function get_icon() {
50: return 'eicon-calendar';
51: }
52:
53: /**
54: * Get widget categories.
55: *
56: * @return array
57: * @since 3.6.0 New: Elementor widgets (beta).
58: */
59: public function get_categories() {
60: return array( 'epl-elements' );
61: }
62:
63: /**
64: * Get widget keywords.
65: *
66: * @return array
67: * @since 3.6.0 New: Elementor widgets (beta).
68: */
69: public function get_keywords() {
70: return array( 'property', 'inspection', 'open', 'home', 'epl' );
71: }
72:
73: /**
74: * Register widget controls.
75: * @since 3.6.0 New: Elementor widgets (beta).
76: */
77: protected function register_controls() {
78:
79: $this->start_controls_section(
80: 'section_style',
81: array(
82: 'label' => esc_html__( 'Style', 'easy-property-listings' ),
83: 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
84: )
85: );
86:
87: $this->add_control(
88: 'text_color',
89: array(
90: 'label' => esc_html__( 'Color', 'easy-property-listings' ),
91: 'type' => \Elementor\Controls_Manager::COLOR,
92: 'selectors' => array(
93: '{{WRAPPER}} .epl-property-inspection' => 'color: {{VALUE}};',
94: ),
95: )
96: );
97:
98: $this->add_group_control(
99: \Elementor\Group_Control_Typography::get_type(),
100: array(
101: 'name' => 'typography',
102: 'selector' => '{{WRAPPER}} .epl-property-inspection',
103: )
104: );
105:
106: $this->end_controls_section();
107: }
108:
109: /**
110: * Render widget output.
111: * @since 3.6.0 New: Elementor widgets (beta).
112: */
113: protected function render() {
114: $property = EPL_Elementor::setup_listing_context();
115: $is_editor = \Elementor\Plugin::$instance->editor->is_edit_mode();
116:
117: if ( ! $property ) {
118: if ( $is_editor ) {
119: echo '<div class="epl-elementor-placeholder">' . esc_html__( 'Inspection Times - No listings found.', 'easy-property-listings' ) . '</div>';
120: }
121: EPL_Elementor::restore_listing_context();
122: return;
123: }
124:
125: echo '<div class="epl-property-inspection">';
126: do_action( 'epl_property_inspection_times' );
127: echo '</div>';
128:
129: EPL_Elementor::restore_listing_context();
130: }
131: }
132: