1: <?php
2: /**
3: * Elementor Single Extensions 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_Single_Extensions Class
17: *
18: * @since 3.6.0
19: */
20: class EPL_Elementor_Single_Extensions 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-single-extensions';
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__( 'Single Extensions', '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-kit-plugins';
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', 'extensions', 'addons', 'hooks', 'epl' );
71: }
72:
73: /**
74: * Register widget controls.
75: * @since 3.6.0 New: Elementor widgets (beta).
76: */
77: protected function register_controls() {
78: // Style Section.
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_responsive_control(
88: 'margin',
89: array(
90: 'label' => esc_html__( 'Margin', 'easy-property-listings' ),
91: 'type' => \Elementor\Controls_Manager::DIMENSIONS,
92: 'size_units' => array( 'px', '%', 'em' ),
93: 'selectors' => array(
94: '{{WRAPPER}} .epl-single-extensions' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
95: ),
96: )
97: );
98:
99: $this->end_controls_section();
100: }
101:
102: /**
103: * Render widget output.
104: * @since 3.6.0 New: Elementor widgets (beta).
105: */
106: protected function render() {
107: $property = EPL_Elementor::setup_listing_context();
108: $is_editor = \Elementor\Plugin::$instance->editor->is_edit_mode();
109:
110: if ( ! $property ) {
111: if ( $is_editor ) {
112: echo '<div class="epl-elementor-placeholder">' . esc_html__( 'Single Extensions - No listings found.', 'easy-property-listings' ) . '</div>';
113: }
114: EPL_Elementor::restore_listing_context();
115: return;
116: }
117:
118: echo '<div class="epl-single-extensions">';
119: do_action( 'epl_single_extensions' );
120: echo '</div>';
121:
122: EPL_Elementor::restore_listing_context();
123: }
124: }
125: