| 1 |
<?php |
| 2 |
namespace Amedea\Widgets; |
| 3 |
|
| 4 |
use \Elementor\Widget_Base; |
| 5 |
use \Elementor\Controls_Manager; |
| 6 |
|
| 7 |
/** |
| 8 |
* Elementor |
| 9 |
* |
| 10 |
* Elementor widget |
| 11 |
* |
| 12 |
* @since 1.0.0 |
| 13 |
*/ |
| 14 |
class amedea__contact_default extends Widget_Base { |
| 15 |
|
| 16 |
/** |
| 17 |
* Retrieve the widget name. |
| 18 |
* |
| 19 |
* @since 1.0.0 |
| 20 |
* |
| 21 |
* @access public |
| 22 |
* |
| 23 |
* @return string Widget name. |
| 24 |
*/ |
| 25 |
public function get_name() { |
| 26 |
return 'contact_default'; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Retrieve the widget title. |
| 31 |
* |
| 32 |
* @since 1.0.0 |
| 33 |
* |
| 34 |
* @access public |
| 35 |
* |
| 36 |
* @return string Widget title. |
| 37 |
*/ |
| 38 |
public function get_title() { |
| 39 |
return esc_html__( 'Contact Default', 'amedea' ); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Retrieve the widget icon. |
| 44 |
* |
| 45 |
* @since 1.0.0 |
| 46 |
* |
| 47 |
* @access public |
| 48 |
* |
| 49 |
* @return string Widget icon. |
| 50 |
*/ |
| 51 |
public function get_icon() { |
| 52 |
return 'eicon-email-field'; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Retrieve the list of scripts the widget depended on. |
| 57 |
* |
| 58 |
* Used to set scripts dependencies required to run the widget. |
| 59 |
* |
| 60 |
* @since 1.0.0 |
| 61 |
* |
| 62 |
* @access public |
| 63 |
* |
| 64 |
* @return array Widget scripts dependencies. |
| 65 |
*/ |
| 66 |
public function get_script_depends() { |
| 67 |
return [ '' ]; |
| 68 |
} |
| 69 |
/** |
| 70 |
* Retrieve the list of categories the widget belongs to. |
| 71 |
* |
| 72 |
* Used to determine where to display the widget in the editor. |
| 73 |
* |
| 74 |
* Note that currently Elementor supports only one category. |
| 75 |
* When multiple categories passed, Elementor uses the first one. |
| 76 |
* |
| 77 |
* @since 1.0.0 |
| 78 |
* |
| 79 |
* @access public |
| 80 |
* |
| 81 |
* @return array Widget categories. |
| 82 |
*/ |
| 83 |
public function get_categories() { |
| 84 |
return [ 'amedea-category' , 'amedea-theme-widgets-category' ]; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
/** |
| 89 |
* Register the widget controls. |
| 90 |
* |
| 91 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 92 |
* |
| 93 |
* @since 1.0.0 |
| 94 |
* |
| 95 |
* @access protected |
| 96 |
*/ |
| 97 |
protected function register_controls() { |
| 98 |
|
| 99 |
|
| 100 |
$this->start_controls_section( |
| 101 |
'section_content0', |
| 102 |
[ |
| 103 |
'label' => esc_html__( 'Color', 'amedea' ), |
| 104 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 105 |
] |
| 106 |
); |
| 107 |
|
| 108 |
$this->add_control( |
| 109 |
'style', |
| 110 |
array( |
| 111 |
'label' => esc_html__('Text Color', 'amedea'), |
| 112 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 113 |
'default' => 'dark', |
| 114 |
'label_block' => true, |
| 115 |
'options' => array( |
| 116 |
'light' => esc_html__('Light', 'amedea'), |
| 117 |
'dark' => esc_html__('Dark', 'amedea'), |
| 118 |
) |
| 119 |
) |
| 120 |
); |
| 121 |
|
| 122 |
$this->end_controls_section(); |
| 123 |
|
| 124 |
$this->start_controls_section( |
| 125 |
'section_content', |
| 126 |
[ |
| 127 |
'label' => esc_html__( 'Marquee', 'amedea' ), |
| 128 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 129 |
] |
| 130 |
); |
| 131 |
|
| 132 |
$this->add_control( |
| 133 |
'content', |
| 134 |
[ |
| 135 |
'label' => esc_html__( 'Marquee Text', 'amedea' ), |
| 136 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 137 |
'default' => esc_html__( 'Wanna spit it out? We will get back to you as soon as possible, we promise!', 'amedea' ), |
| 138 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 139 |
] |
| 140 |
); |
| 141 |
|
| 142 |
$this->end_controls_section(); |
| 143 |
|
| 144 |
$this->start_controls_section( |
| 145 |
'section_content1', |
| 146 |
[ |
| 147 |
'label' => esc_html__( 'Let's talk', 'amedea' ), |
| 148 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 149 |
] |
| 150 |
); |
| 151 |
|
| 152 |
$this->add_control( |
| 153 |
'text_area_1', |
| 154 |
[ |
| 155 |
'label' => esc_html__( 'Heading', 'amedea' ), |
| 156 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 157 |
'default' => __( 'Let's talk', 'amedea' ), |
| 158 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 159 |
] |
| 160 |
); |
| 161 |
|
| 162 |
$this->add_control( |
| 163 |
'text_area_2', |
| 164 |
[ |
| 165 |
'label' => esc_html__( 'Text area', 'amedea' ), |
| 166 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 167 |
'default' => __( 'Wanna spit it out? We will get back to you as soon as possible, we promise!', 'amedea' ), |
| 168 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 169 |
] |
| 170 |
); |
| 171 |
|
| 172 |
$this->end_controls_section(); |
| 173 |
|
| 174 |
$this->start_controls_section( |
| 175 |
'section_content2', |
| 176 |
[ |
| 177 |
'label' => esc_html__( 'Find Us', 'amedea' ), |
| 178 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 179 |
] |
| 180 |
); |
| 181 |
|
| 182 |
$this->add_control( |
| 183 |
'text_area_3', |
| 184 |
[ |
| 185 |
'label' => esc_html__( 'Heading', 'amedea' ), |
| 186 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 187 |
'default' => esc_html__( 'Find Us', 'amedea' ), |
| 188 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 189 |
] |
| 190 |
); |
| 191 |
|
| 192 |
$this->add_control( |
| 193 |
'text_area_4', |
| 194 |
[ |
| 195 |
'label' => esc_html__( 'Heading', 'amedea' ), |
| 196 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 197 |
'default' => __( 'Kounicova 51, Brno</br>Czech Republic', 'amedea' ), |
| 198 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 199 |
] |
| 200 |
); |
| 201 |
|
| 202 |
$this->end_controls_section(); |
| 203 |
|
| 204 |
$this->start_controls_section( |
| 205 |
'section_content3', |
| 206 |
[ |
| 207 |
'label' => esc_html__( 'Say Hello', 'amedea' ), |
| 208 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 209 |
] |
| 210 |
); |
| 211 |
|
| 212 |
$this->add_control( |
| 213 |
'text_area_5', |
| 214 |
[ |
| 215 |
'label' => esc_html__( 'Say Hello', 'amedea' ), |
| 216 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 217 |
'default' => esc_html__( 'Say Hello', 'amedea' ), |
| 218 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 219 |
] |
| 220 |
); |
| 221 |
|
| 222 |
$this->add_control( |
| 223 |
'text_area_6', |
| 224 |
[ |
| 225 |
'label' => esc_html__( 'Heading', 'amedea' ), |
| 226 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 227 |
'default' => __( 'email@website.com<br/>+420 720 000 000', 'amedea' ), |
| 228 |
'placeholder' => esc_html__( 'Type your content here', 'amedea' ), |
| 229 |
] |
| 230 |
); |
| 231 |
|
| 232 |
$this->end_controls_section(); |
| 233 |
|
| 234 |
$this->start_controls_section( |
| 235 |
'section_content4', |
| 236 |
[ |
| 237 |
'label' => esc_html__( 'Google Map', 'amedea' ), |
| 238 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 239 |
] |
| 240 |
); |
| 241 |
|
| 242 |
$this->add_control( |
| 243 |
'button_text', |
| 244 |
[ |
| 245 |
'label' => esc_html__( 'View on map', 'amedea' ), |
| 246 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 247 |
'default' => esc_html__( 'View on map', 'amedea' ), |
| 248 |
] |
| 249 |
); |
| 250 |
|
| 251 |
$this->add_control( |
| 252 |
'button_url', |
| 253 |
[ |
| 254 |
'label' => esc_html__( 'GoogleMap URL', 'amedea' ), |
| 255 |
'type' => \Elementor\Controls_Manager::URL, |
| 256 |
] |
| 257 |
); |
| 258 |
|
| 259 |
$this->end_controls_section(); |
| 260 |
|
| 261 |
$this->start_controls_section( |
| 262 |
'section_content5', |
| 263 |
[ |
| 264 |
'label' => esc_html__( 'Image', 'amedea' ), |
| 265 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 266 |
] |
| 267 |
); |
| 268 |
|
| 269 |
$this->add_control( |
| 270 |
'image', |
| 271 |
[ |
| 272 |
'label' => esc_html__( 'Choose Image', 'amedea' ), |
| 273 |
'type' => \Elementor\Controls_Manager::MEDIA, |
| 274 |
'default' => [ |
| 275 |
'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 276 |
], |
| 277 |
] |
| 278 |
); |
| 279 |
|
| 280 |
$this->end_controls_section(); |
| 281 |
|
| 282 |
|
| 283 |
} |
| 284 |
|
| 285 |
/** |
| 286 |
* Render the widget output on the frontend. |
| 287 |
* |
| 288 |
* Written in PHP and used to generate the final HTML. |
| 289 |
* |
| 290 |
* @since 1.0.0 |
| 291 |
* |
| 292 |
* @access protected |
| 293 |
*/ |
| 294 |
|
| 295 |
|
| 296 |
protected function render() { |
| 297 |
$settings = $this->get_settings_for_display(); |
| 298 |
$style = $settings['style']; |
| 299 |
|
| 300 |
?> |
| 301 |
<section class="contact__container <?php echo esc_html($settings['style']); ?>"> |
| 302 |
<div class="contact__page"> |
| 303 |
<div class="content__inner"> |
| 304 |
|
| 305 |
<div class="contact__default"> |
| 306 |
<div class="text__inner inner_marquee"> |
| 307 |
<div class="marquee__container marquee__contact"> |
| 308 |
<div class="marquee"> |
| 309 |
<div class="marquee__inner" aria-hidden="true"> |
| 310 |
<span><?php echo esc_html($settings['content']); ?></span> |
| 311 |
<span><?php echo esc_html($settings['content']); ?></span> |
| 312 |
</div> |
| 313 |
</div> |
| 314 |
</div> |
| 315 |
</div> |
| 316 |
|
| 317 |
<div class="text__inner"> |
| 318 |
<p><?php echo esc_html($settings['text_area_2']); ?></p> |
| 319 |
</div> |
| 320 |
|
| 321 |
<div class="text__inner_second"> |
| 322 |
<h5><?php echo esc_html($settings['text_area_3']); ?></h5> |
| 323 |
<p><?php echo esc_html($settings['text_area_4']); ?></p> |
| 324 |
</div> |
| 325 |
<div class="text__inner_third"> |
| 326 |
<h5><?php echo esc_html($settings['text_area_5']); ?></h5> |
| 327 |
<p><?php echo esc_html($settings['text_area_6']); ?></p> |
| 328 |
</div> |
| 329 |
<?php if ( ! empty( $settings['button_url']['url'] ) ) { ?> |
| 330 |
<div class="text__inner_last"> |
| 331 |
<p class="text__link"> |
| 332 |
<a href="<?php echo esc_url($settings['button_url']['url']); ?>" target="_blank" class=""> |
| 333 |
<?php echo esc_html($settings['button_text']); ?> |
| 334 |
</a> |
| 335 |
</p> |
| 336 |
</div> |
| 337 |
<?php } ?> |
| 338 |
</div> |
| 339 |
</div> |
| 340 |
</div> |
| 341 |
<?php if ( ! empty( $settings['image']['url'] ) ) { ?> |
| 342 |
<div class="contact__image"> |
| 343 |
<img src="<?php echo esc_attr($settings['image']['url']); ?>" alt="" /> |
| 344 |
</div> |
| 345 |
<?php } ?> |
| 346 |
</section> |
| 347 |
|
| 348 |
<?php |
| 349 |
} |
| 350 |
|
| 351 |
/** |
| 352 |
* Render the widget output in the editor. |
| 353 |
* |
| 354 |
* Written as a Backbone JavaScript template and used to generate the live preview. |
| 355 |
* |
| 356 |
* @since 1.0.0 |
| 357 |
* |
| 358 |
* @access protected |
| 359 |
*/ |
| 360 |
protected function content_template() {} |
| 361 |
|
| 362 |
} |
| 363 |
|