| 1 |
<?php |
| 2 |
/** |
| 3 |
* Elementor Property Street View Widget. |
| 4 |
* |
| 5 |
* @since 1.0.0 |
| 6 |
*/ |
| 7 |
class Elementor_Property_Street_View_Widget extends \Elementor\Widget_Base { |
| 8 |
|
| 9 |
public function get_name() { |
| 10 |
return 'property-street-view'; |
| 11 |
} |
| 12 |
|
| 13 |
public function get_title() { |
| 14 |
return __( 'Street View', 'propertyhive' ); |
| 15 |
} |
| 16 |
|
| 17 |
public function get_icon() { |
| 18 |
return 'eicon-google-maps'; |
| 19 |
} |
| 20 |
|
| 21 |
public function get_categories() { |
| 22 |
return [ 'property-hive' ]; |
| 23 |
} |
| 24 |
|
| 25 |
public function get_keywords() { |
| 26 |
return [ 'property hive', 'propertyhive', 'property', 'street view', 'map', 'google map' ]; |
| 27 |
} |
| 28 |
|
| 29 |
protected function register_controls() { |
| 30 |
|
| 31 |
$this->start_controls_section( |
| 32 |
'settings_section', |
| 33 |
[ |
| 34 |
'label' => __( 'Street View Settings', 'propertyhive' ), |
| 35 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 36 |
] |
| 37 |
); |
| 38 |
|
| 39 |
$this->add_control( |
| 40 |
'height', |
| 41 |
[ |
| 42 |
'label' => __( 'Height', 'propertyhive' ) . ' (px)', |
| 43 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 44 |
'input_type' => 'number', |
| 45 |
'default' => 400 |
| 46 |
] |
| 47 |
); |
| 48 |
|
| 49 |
$this->end_controls_section(); |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
protected function render() { |
| 54 |
|
| 55 |
global $property; |
| 56 |
|
| 57 |
$settings = $this->get_settings_for_display(); |
| 58 |
|
| 59 |
if ( !isset( $property->id ) ) { |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
$attributes = array(); |
| 64 |
if ( isset($settings['height']) && $settings['height'] != '' ) |
| 65 |
{ |
| 66 |
$attributes['height'] = $settings['height']; |
| 67 |
} |
| 68 |
|
| 69 |
$attributes = apply_filters( 'propertyhive_elementor_property_street_view_attributes', $attributes ); |
| 70 |
|
| 71 |
get_property_street_view($attributes); |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |