PluginProbe
Property Hive / 2.2.4
Property Hive v2.2.4
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 1.4.62 All 260 releases
propertyhive / includes / elementor-widgets / property-tenure.php

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

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