Welbim_Contact.php (6499B)
1 <?php 2 3 namespace Welbim\Helper\Elementor\Widgets; 4 5 use Elementor\Utils; 6 use Elementor\Controls_Manager; 7 use Elementor\Widget_Base; 8 use Elementor\Plugin; 9 use \Elementor\Repeater; 10 use Elementor\Group_Control_Typography; 11 12 class Welbim_Contact extends Widget_Base 13 { 14 15 public function get_name() 16 { 17 return 'welbim_contact'; 18 } 19 20 public function get_title() 21 { 22 return esc_html__('Welbim Contact', 'welbim-core'); 23 } 24 25 public function get_icon() 26 { 27 return 'sds-widget-ico'; 28 } 29 30 public function get_categories() 31 { 32 return ['Welbim']; 33 } 34 35 protected function _register_controls() 36 { 37 38 $this->start_controls_section( 39 'general', 40 [ 41 'label' => esc_html__('General', 'welbim-core'), 42 ] 43 ); 44 45 $this->add_control( 46 'iframe_box', 47 [ 48 'label' => esc_html__('Iframe Box', 'welbim-core'), 49 'type' => Controls_Manager::TEXTAREA, 50 'rows' => 6, 51 'placeholder' => esc_html__('Type your description here', 'welbim-core'), 52 ] 53 ); 54 55 $this->add_control( 56 'tag_line', 57 [ 58 'label' => esc_html__('Tag Line', 'welbim-core'), 59 'type' => Controls_Manager::TEXT, 60 ] 61 ); 62 63 $this->add_control( 64 'heading', 65 [ 66 'label' => esc_html__('Heading', 'welbim-core'), 67 'type' => Controls_Manager::TEXT, 68 ] 69 ); 70 71 $this->add_control( 72 'description', 73 [ 74 'label' => esc_html__('Description', 'welbim-core'), 75 'type' => Controls_Manager::TEXTAREA, 76 'rows' => 6, 77 'placeholder' => esc_html__('Type your description here', 'welbim-core'), 78 ] 79 ); 80 81 $this->end_controls_section(); 82 83 $this->start_controls_section( 84 'item', 85 [ 86 'label' => esc_html__('Item', 'welbim-core'), 87 ] 88 ); 89 90 $repeater = new Repeater(); 91 92 $repeater->add_control( 93 'item_title', 94 [ 95 'label' => esc_html__('Title', 'welbim-core'), 96 'type' => Controls_Manager::TEXT, 97 ] 98 ); 99 100 $repeater->add_control( 101 'item_icon', 102 [ 103 'label' => esc_html__('Icon', 'welbim-core'), 104 'type' => Controls_Manager::ICONS, 105 ] 106 ); 107 108 $repeater->add_control( 109 'item_description', 110 [ 111 'label' => esc_html__('Description', 'welbim-core'), 112 'type' => Controls_Manager::TEXTAREA, 113 'placeholder' => esc_html__('Type your description here', 'welbim-core'), 114 ] 115 ); 116 117 $this->add_control( 118 'items', 119 [ 120 'label' => esc_html__('Repeater List', 'welbim-core'), 121 'type' => Controls_Manager::REPEATER, 122 'fields' => $repeater->get_controls(), 123 'default' => [ 124 [ 125 'list_title' => esc_html__('Title #1', 'welbim-core'), 126 'list_content' => esc_html__('Item content. Click the edit button to change this text.', 'welbim-core'), 127 ], 128 ], 129 ] 130 ); 131 132 $this->end_controls_section(); 133 134 //Typography Section 135 $this->start_controls_section( 136 'typography_section', 137 array( 138 'label' => __('Typography Section', 'welbim'), 139 'tab' => Controls_Manager::TAB_STYLE, 140 ) 141 ); 142 143 $this->add_group_control( 144 Group_Control_Typography::get_type(), 145 array( 146 'name' => 'tagline_typography', 147 'label' => __('Tagline', 'welbim'), 148 'selector' => '{{WRAPPER}} .sec-title .sub-title', 149 150 ) 151 ); 152 153 $this->add_group_control( 154 Group_Control_Typography::get_type(), 155 array( 156 'name' => 'heading_typography', 157 'label' => __('Heading', 'welbim'), 158 'selector' => '{{WRAPPER}} .contact-section .sec-title h2', 159 160 ) 161 ); 162 163 $this->add_group_control( 164 Group_Control_Typography::get_type(), 165 array( 166 'name' => 'items_title_typography', 167 'label' => __('Items Title', 'welbim'), 168 'selector' => '{{WRAPPER}} .contact-info h5', 169 170 ) 171 ); 172 173 $this->end_controls_section(); 174 175 //Color Section 176 $this->start_controls_section( 177 'color_section', 178 array( 179 'label' => __('Color Section', 'welbim'), 180 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 181 ) 182 ); 183 184 $this->add_control( 185 'tagline_color', 186 array( 187 'label' => __('Tagline', 'welbim'), 188 'separator' => 'before', 189 'type' => \Elementor\Controls_Manager::COLOR, 190 'selectors' => array( 191 '{{WRAPPER}} .sec-title .sub-title' => 'color: {{VALUE}}', 192 ), 193 ) 194 ); 195 196 $this->add_control( 197 'heading_color', 198 array( 199 'label' => __('Heading ', 'welbim'), 200 'separator' => 'before', 201 'type' => \Elementor\Controls_Manager::COLOR, 202 'selectors' => array( 203 '{{WRAPPER}} .contact-section .sec-title h2' => 'color: {{VALUE}}', 204 ), 205 ) 206 ); 207 208 $this->add_control( 209 'icon_bg_color', 210 array( 211 'label' => __('Icon BG Color ', 'welbim'), 212 'separator' => 'before', 213 'type' => \Elementor\Controls_Manager::COLOR, 214 'selectors' => array( 215 '{{WRAPPER}} .contact-info .icon' => 'background: {{VALUE}}', 216 ), 217 ) 218 ); 219 220 $this->add_control( 221 'icon_color', 222 array( 223 'label' => __('Icon Color ', 'welbim'), 224 'separator' => 'before', 225 'type' => \Elementor\Controls_Manager::COLOR, 226 'selectors' => array( 227 '{{WRAPPER}} .contact-info .icon' => 'color: {{VALUE}}', 228 ), 229 ) 230 ); 231 232 233 $this->end_controls_section(); 234 } 235 protected function render() 236 { 237 $settings = $this->get_settings_for_display(); 238 $iframe_box = $settings["iframe_box"]; 239 $tag_line = $settings["tag_line"]; 240 $heading = $settings["heading"]; 241 $description = $settings["description"]; 242 ?> 243 <!-- Contact section --> 244 <section class="contact-section"> 245 <div class="auto-container"> 246 <div class="row"> 247 <div class="col-lg-8"> 248 <div class="contact-map mb-30"> 249 <?php echo $iframe_box; ?> 250 </div> 251 </div> 252 <div class="col-lg-4"> 253 <div class="contact-details mb-30"> 254 <div class="sec-title mb-20"> 255 <div class="sub-title"><?php echo $tag_line; ?></div> 256 <h2><?php echo $heading; ?></h2> 257 </div> 258 <div class="text mb-40"><?php echo $description; ?> </div> 259 <div class="contact-info"> 260 <?php 261 $i = 1; 262 foreach ($settings["items"] as $item) { 263 $item_title = $item["item_title"]; 264 $item_icon = $item["item_icon"]; 265 $item_description = $item["item_description"]; 266 ?> 267 <div class="icon-box"> 268 <div class="icon"><span class="<?php echo $item_icon['value']; ?>"></span></div> 269 <div class="content"> 270 <h5><?php echo $item_title; ?></h5> 271 <div class="text"><?php echo $item_description; ?></div> 272 </div> 273 </div> 274 <?php 275 $i++; 276 } 277 ?> 278 </div> 279 </div> 280 </div> 281 </div> 282 </div> 283 </section> 284 <?php 285 } 286 }