| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | if ( ! defined( 'ABSPATH' ) ) { |
| 12: | exit; |
| 13: | } |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | class EPL_Elementor_Property_Gallery extends \Elementor\Widget_Base { |
| 21: | use EPL_Elementor_Dynamic_Widget; |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public function get_name() { |
| 30: | return 'epl-property-gallery'; |
| 31: | } |
| 32: | |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public function get_title() { |
| 40: | return esc_html__( 'Gallery', 'easy-property-listings' ); |
| 41: | } |
| 42: | |
| 43: | |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public function get_icon() { |
| 50: | return 'eicon-gallery-grid'; |
| 51: | } |
| 52: | |
| 53: | |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | public function get_categories() { |
| 60: | return array( 'epl-elements' ); |
| 61: | } |
| 62: | |
| 63: | |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | |
| 69: | public function get_keywords() { |
| 70: | return array( 'property', 'gallery', 'image', 'epl' ); |
| 71: | } |
| 72: | |
| 73: | |
| 74: | |
| 75: | |
| 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_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-property-gallery' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 95: | ), |
| 96: | ) |
| 97: | ); |
| 98: | |
| 99: | $this->end_controls_section(); |
| 100: | } |
| 101: | |
| 102: | |
| 103: | |
| 104: | |
| 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__( 'Property Gallery - No listings found.', 'easy-property-listings' ) . '</div>'; |
| 113: | } |
| 114: | EPL_Elementor::restore_listing_context(); |
| 115: | return; |
| 116: | } |
| 117: | |
| 118: | echo '<div class="epl-property-gallery">'; |
| 119: | do_action( 'epl_property_gallery' ); |
| 120: | echo '</div>'; |
| 121: | |
| 122: | EPL_Elementor::restore_listing_context(); |
| 123: | } |
| 124: | } |
| 125: | |