| 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_Content 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-content'; |
| 31: | } |
| 32: | |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public function get_title() { |
| 40: | return esc_html__( 'Content', 'easy-property-listings' ); |
| 41: | } |
| 42: | |
| 43: | |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public function get_icon() { |
| 50: | return 'eicon-post-content'; |
| 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', 'content', 'description', '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_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-content' => '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-content', |
| 103: | ) |
| 104: | ); |
| 105: | |
| 106: | $this->add_responsive_control( |
| 107: | 'text_align', |
| 108: | array( |
| 109: | 'label' => esc_html__( 'Alignment', 'easy-property-listings' ), |
| 110: | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 111: | 'options' => array( |
| 112: | 'left' => array( |
| 113: | 'title' => esc_html__( 'Left', 'easy-property-listings' ), |
| 114: | 'icon' => 'eicon-text-align-left', |
| 115: | ), |
| 116: | 'center' => array( |
| 117: | 'title' => esc_html__( 'Center', 'easy-property-listings' ), |
| 118: | 'icon' => 'eicon-text-align-center', |
| 119: | ), |
| 120: | 'right' => array( |
| 121: | 'title' => esc_html__( 'Right', 'easy-property-listings' ), |
| 122: | 'icon' => 'eicon-text-align-right', |
| 123: | ), |
| 124: | 'justify' => array( |
| 125: | 'title' => esc_html__( 'Justify', 'easy-property-listings' ), |
| 126: | 'icon' => 'eicon-text-align-justify', |
| 127: | ), |
| 128: | ), |
| 129: | 'selectors' => array( |
| 130: | '{{WRAPPER}} .epl-property-content' => 'text-align: {{VALUE}};', |
| 131: | ), |
| 132: | ) |
| 133: | ); |
| 134: | |
| 135: | $this->end_controls_section(); |
| 136: | } |
| 137: | |
| 138: | |
| 139: | |
| 140: | |
| 141: | |
| 142: | protected function render() { |
| 143: | $property = EPL_Elementor::setup_listing_context(); |
| 144: | $is_editor = \Elementor\Plugin::$instance->editor->is_edit_mode(); |
| 145: | |
| 146: | if ( ! $property ) { |
| 147: | if ( $is_editor ) { |
| 148: | echo '<div class="epl-elementor-placeholder">' . esc_html__( 'Property Content - No listings found.', 'easy-property-listings' ) . '</div>'; |
| 149: | } |
| 150: | EPL_Elementor::restore_listing_context(); |
| 151: | return; |
| 152: | } |
| 153: | |
| 154: | echo '<div class="epl-property-content">'; |
| 155: | do_action( 'epl_property_the_content' ); |
| 156: | echo '</div>'; |
| 157: | |
| 158: | EPL_Elementor::restore_listing_context(); |
| 159: | } |
| 160: | } |
| 161: | |