PluginProbe
Property Hive / 2.2.4
Property Hive v2.2.4
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / elementor-widgets / property-deposit.php

property-deposit.php in Property Hive 2.2.4, at includes/elementor-widgets/property-deposit.php

174 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor Property Deposit Widget.
4 *
5 * @since 1.0.0
6 */
7 class Elementor_Property_Deposit_Widget extends \Elementor\Widget_Base {
8
9 public function get_name() {
10 return 'property-deposit';
11 }
12
13 public function get_title() {
14 return __( 'Deposit', 'propertyhive' );
15 }
16
17 public function get_icon() {
18 return 'eicon-number-field';
19 }
20
21 public function get_categories() {
22 return [ 'property-hive' ];
23 }
24
25 public function get_keywords() {
26 return [ 'property hive', 'propertyhive', 'property', 'deposit' ];
27 }
28
29 protected function register_controls() {
30
31 $this->start_controls_section(
32 'content_section',
33 [
34 'label' => __( 'Deposit', 'propertyhive' ),
35 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
36 ]
37 );
38
39 $this->add_control(
40 'icon',
41 [
42 'label' => __( 'Icon', 'propertyhive' ),
43 'type' => \Elementor\Controls_Manager::ICONS,
44 'default' => [
45 'value' => 'fas fa-pound-sign',
46 'library' => 'solid',
47 ],
48 ]
49 );
50
51 $this->add_control(
52 'before',
53 [
54 'label' => __( 'Before', 'propertyhive' ),
55 'type' => \Elementor\Controls_Manager::TEXT,
56 'default' => __( 'Deposit', 'propertyhive' ),
57 ]
58 );
59
60 $this->add_control(
61 'after',
62 [
63 'label' => __( 'After', 'propertyhive' ),
64 'type' => \Elementor\Controls_Manager::TEXT,
65 ]
66 );
67
68 $this->end_controls_section();
69
70 $this->start_controls_section(
71 'style_section',
72 [
73 'label' => __( 'Available Date', 'propertyhive' ),
74 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
75 ]
76 );
77
78 $this->add_group_control(
79 \Elementor\Group_Control_Typography::get_type(),
80 [
81 'name' => 'typography',
82 'label' => __( 'Typography', 'propertyhive' ),
83 'global' => [
84 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY,
85 ],
86 'selector' => '{{WRAPPER}} .elementor-widget-deposit',
87 ]
88 );
89
90 $this->add_control(
91 'color',
92 [
93 'label' => __( 'Colour', 'propertyhive' ),
94 'type' => \Elementor\Controls_Manager::COLOR,
95 'global' => [
96 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY,
97 ],
98 'selectors' => [
99 '{{WRAPPER}} .elementor-widget-deposit' => 'color: {{VALUE}}',
100 ],
101 ]
102 );
103
104 $this->add_control(
105 'text_align',
106 [
107 'label' => __( 'Alignment', 'propertyhive' ),
108 'type' => \Elementor\Controls_Manager::CHOOSE,
109 'options' => [
110 'left' => [
111 'title' => __( 'Left', 'propertyhive' ),
112 'icon' => 'fa fa-align-left',
113 ],
114 'center' => [
115 'title' => __( 'Center', 'propertyhive' ),
116 'icon' => 'fa fa-align-center',
117 ],
118 'right' => [
119 'title' => __( 'Right', 'propertyhive' ),
120 'icon' => 'fa fa-align-right',
121 ],
122 ],
123 'default' => 'left',
124 'toggle' => true,
125 'selectors' => [
126 '{{WRAPPER}} .elementor-widget-deposit' => 'text-align: {{VALUE}}',
127 ],
128 ]
129 );
130
131 $this->end_controls_section();
132
133 }
134
135 protected function render() {
136
137 global $property;
138
139 $settings = $this->get_settings_for_display();
140
141 if ( !isset($property->id) ) {
142 return;
143 }
144
145 if ( $property->department != 'residential-lettings' && ph_get_custom_department_based_on( $property->department ) != 'residential-lettings' )
146 {
147 return;
148 }
149
150 if ( $property->get_formatted_deposit() == '' )
151 {
152 return;
153 }
154
155 echo '<div class="elementor-widget-deposit>';
156 if ( isset($settings['icon']) && !empty($settings['icon']) )
157 {
158 \Elementor\Icons_Manager::render_icon( $settings['icon'], [ 'aria-hidden' => 'true' ] );
159 echo ' ';
160 }
161 if ( isset($settings['before']) && !empty($settings['before']) )
162 {
163 echo $settings['before'] . ' ';
164 }
165 echo $property->get_formatted_deposit();
166 if ( isset($settings['after']) && !empty($settings['after']) )
167 {
168 echo ' ' . $settings['after'];
169 }
170 echo '</div>';
171
172 }
173
174 }