| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wdk\Elementor\Widgets; |
| 4 |
|
| 5 |
use Wdk\Elementor\Widgets\WdkElementorBase; |
| 6 |
use Elementor\Widget_Base; |
| 7 |
use Elementor\Controls_Manager; |
| 8 |
use Elementor\Utils; |
| 9 |
use Elementor\Typography; |
| 10 |
use Elementor\Editor; |
| 11 |
use Elementor\Plugin; |
| 12 |
use Elementor\Repeater; |
| 13 |
use Elementor\Core\Schemes; |
| 14 |
use Elementor\Icons_Manager; |
| 15 |
use Elementor\Group_Control_Typography; |
| 16 |
use Elementor\Group_Control_Border; |
| 17 |
use Elementor\Group_Control_Box_Shadow; |
| 18 |
|
| 19 |
if (!defined('ABSPATH')) |
| 20 |
exit; // Exit if accessed directly |
| 21 |
|
| 22 |
/** |
| 23 |
* @since 1.1.0 |
| 24 |
*/ |
| 25 |
class WdkCategoriesCarousel extends WdkElementorBase { |
| 26 |
|
| 27 |
public function __construct($data = array(), $args = null) { |
| 28 |
|
| 29 |
\Elementor\Controls_Manager::add_tab( |
| 30 |
'tab_conf', |
| 31 |
esc_html__('Settings', 'wpdirectorykit') |
| 32 |
); |
| 33 |
|
| 34 |
\Elementor\Controls_Manager::add_tab( |
| 35 |
'tab_layout', |
| 36 |
esc_html__('Layout', 'wpdirectorykit') |
| 37 |
); |
| 38 |
|
| 39 |
\Elementor\Controls_Manager::add_tab( |
| 40 |
'tab_content', |
| 41 |
esc_html__('Main', 'wpdirectorykit') |
| 42 |
); |
| 43 |
|
| 44 |
if ($this->is_edit_mode_load()) { |
| 45 |
$this->enqueue_styles_scripts(); |
| 46 |
} |
| 47 |
|
| 48 |
parent::__construct($data, $args); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Retrieve the widget name. |
| 53 |
* |
| 54 |
* @since 1.1.0 |
| 55 |
* |
| 56 |
* @access public |
| 57 |
* |
| 58 |
* @return string Widget name. |
| 59 |
*/ |
| 60 |
public function get_name() { |
| 61 |
return 'wdk-categories-carousel'; |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Retrieve the widget title. |
| 66 |
* |
| 67 |
* @since 1.1.0 |
| 68 |
* |
| 69 |
* @access public |
| 70 |
* |
| 71 |
* @return string Widget title. |
| 72 |
*/ |
| 73 |
public function get_title() { |
| 74 |
return esc_html__('Wdk Categories Carousel', 'wpdirectorykit'); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Retrieve the widget icon. |
| 79 |
* |
| 80 |
* @since 1.1.0 |
| 81 |
* |
| 82 |
* @access public |
| 83 |
* |
| 84 |
* @return string Widget icon. |
| 85 |
*/ |
| 86 |
public function get_icon() { |
| 87 |
return 'eicon-carousel'; |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Register the widget controls. |
| 92 |
* |
| 93 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 94 |
* |
| 95 |
* @since 1.1.0 |
| 96 |
* |
| 97 |
* @access protected |
| 98 |
*/ |
| 99 |
protected function register_controls() { |
| 100 |
$this->generate_controls_conf(); |
| 101 |
$this->generate_controls_layout(); |
| 102 |
$this->generate_controls_styles(); |
| 103 |
$this->generate_controls_content(); |
| 104 |
|
| 105 |
$this->insert_pro_message('1'); |
| 106 |
parent::register_controls(); |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Render the widget output on the frontend. |
| 111 |
* |
| 112 |
* Written in PHP and used to generate the final HTML. |
| 113 |
* |
| 114 |
* @since 1.1.0 |
| 115 |
* |
| 116 |
* @access protected |
| 117 |
*/ |
| 118 |
protected function render() { |
| 119 |
parent::render(); |
| 120 |
|
| 121 |
$this->data['id_element'] = $this->get_id(); |
| 122 |
$this->data['settings'] = $this->get_settings(); |
| 123 |
|
| 124 |
$controller = 'category'; |
| 125 |
$this->WMVC->model($controller.'_m'); |
| 126 |
$this->WMVC->model('listing_m'); |
| 127 |
$this->data['results'] = array(); |
| 128 |
|
| 129 |
if($this->data['settings']['conf_results_type'] == 'custom_categories') { |
| 130 |
|
| 131 |
$categories_ids = array(); |
| 132 |
foreach($this->data['settings']['conf_custom_results'] as $category) { |
| 133 |
if(isset($category['category_id']) && !empty($category['category_id'])) { |
| 134 |
$categories_ids [] = $category['category_id']; |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
/* where in */ |
| 139 |
if(!empty($categories_ids)){ |
| 140 |
|
| 141 |
$this->WMVC->db->select($this->WMVC->{$controller.'_m'}->_table_name.'.*, COUNT('.$this->WMVC->listing_m->_table_name.'.post_id) AS listings_counter'); |
| 142 |
$this->WMVC->db->join($this->WMVC->listing_m->_table_name.' ON '.$this->WMVC->listing_m->_table_name.'.category_id = '.$this->WMVC->{$controller.'_m'}->_table_name.'.idcategory', TRUE, 'LEFT'); |
| 143 |
$this->WMVC->db->where($this->WMVC->{$controller.'_m'}->_table_name.'.idcategory IN(' . implode(',', $categories_ids) . ')', null, false); |
| 144 |
$this->WMVC->db->order_by('FIELD('.$this->WMVC->{$controller.'_m'}->_table_name.'.idcategory, '. implode(',', $categories_ids) . ')'); |
| 145 |
$this->WMVC->db->group_by($this->WMVC->{$controller.'_m'}->_primary_key); |
| 146 |
|
| 147 |
$this->data['results'] = $this->WMVC->{$controller.'_m'}->get(); |
| 148 |
} |
| 149 |
|
| 150 |
} else { |
| 151 |
$order_by = NULL; |
| 152 |
if(!empty($this->data['settings']['conf_order_by'])) |
| 153 |
$order_by = $this->data['settings']['conf_order_by'].' '.$this->data['settings']['conf_order']; |
| 154 |
|
| 155 |
$this->data['results'] = $this->WMVC->{$controller.'_m'}->get_pagination($this->data['settings']['conf_limit'], NULL, array(), $order_by); |
| 156 |
} |
| 157 |
|
| 158 |
$this->data['is_edit_mode']= false; |
| 159 |
if(Plugin::$instance->editor->is_edit_mode()) |
| 160 |
$this->data['is_edit_mode']= true; |
| 161 |
|
| 162 |
echo $this->view('wdk-categories-carousel', $this->data); |
| 163 |
} |
| 164 |
|
| 165 |
private function generate_controls_conf() { |
| 166 |
$this->start_controls_section( |
| 167 |
'tab_conf_main_section', |
| 168 |
[ |
| 169 |
'label' => esc_html__('Main', 'wpdirectorykit'), |
| 170 |
'tab' => '1', |
| 171 |
] |
| 172 |
); |
| 173 |
|
| 174 |
$pages = array('' => __('Not Selected', 'wpdirectorykit')); |
| 175 |
foreach(get_pages(array('sort_column' => 'post_title')) as $page) |
| 176 |
{ |
| 177 |
$pages[$page->ID] = $page->post_title.' #'.$page->ID; |
| 178 |
} |
| 179 |
|
| 180 |
$this->add_control( |
| 181 |
'conf_link', |
| 182 |
[ |
| 183 |
'label' => __( 'Open results on page', 'wpdirectorykit' ), |
| 184 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 185 |
'default' => '', |
| 186 |
'options' => $pages |
| 187 |
] |
| 188 |
); |
| 189 |
|
| 190 |
$this->add_control( |
| 191 |
'conf_results_type', |
| 192 |
[ |
| 193 |
'label' => __( 'Show type', 'wpdirectorykit' ), |
| 194 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 195 |
'default' => 'results_categories', |
| 196 |
'options' => [ |
| 197 |
'results_categories' => __( 'All Categories', 'wpdirectorykit' ), |
| 198 |
'custom_categories' => __( 'Specific', 'wpdirectorykit' ), |
| 199 |
], |
| 200 |
'separator' => 'after', |
| 201 |
] |
| 202 |
); |
| 203 |
|
| 204 |
$this->add_control( |
| 205 |
'important_note', |
| 206 |
[ |
| 207 |
'label' => '', |
| 208 |
'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 209 |
'raw' => sprintf(__( 'Manage Categories <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_category')), |
| 210 |
'content_classes' => 'wdk_elementor_hint', |
| 211 |
] |
| 212 |
); |
| 213 |
|
| 214 |
$this->add_control( |
| 215 |
'conf_limit', |
| 216 |
[ |
| 217 |
'label' => __( 'Limit Categories', 'wpdirectorykit' ), |
| 218 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 219 |
'min' => 1, |
| 220 |
'max' => 50, |
| 221 |
'step' => 1, |
| 222 |
'default' => 6, |
| 223 |
'conditions' => [ |
| 224 |
'terms' => [ |
| 225 |
[ |
| 226 |
'name' => 'conf_results_type', |
| 227 |
'operator' => '==', |
| 228 |
'value' => 'results_categories', |
| 229 |
] |
| 230 |
], |
| 231 |
], |
| 232 |
] |
| 233 |
); |
| 234 |
|
| 235 |
$this->add_control( |
| 236 |
'conf_order_by', |
| 237 |
[ |
| 238 |
'label' => __('Order By Column', 'wpdirectorykit'), |
| 239 |
'type' => Controls_Manager::SELECT, |
| 240 |
'label_block' => true, |
| 241 |
'options' => [ |
| 242 |
'' => __('None', 'wpdirectorykit'), |
| 243 |
'category_title' => __('Title', 'wpdirectorykit'), |
| 244 |
'idcategory' => __('Category id', 'wpdirectorykit'), |
| 245 |
'order_index' => __('Order index', 'wpdirectorykit'), |
| 246 |
'listings_counter' => __('Most Listings', 'wpdirectorykit'), |
| 247 |
], |
| 248 |
'default' => 'order_index', |
| 249 |
'conditions' => [ |
| 250 |
'terms' => [ |
| 251 |
[ |
| 252 |
'name' => 'conf_results_type', |
| 253 |
'operator' => '==', |
| 254 |
'value' => 'results_categories', |
| 255 |
] |
| 256 |
], |
| 257 |
], |
| 258 |
] |
| 259 |
); |
| 260 |
|
| 261 |
$this->add_control( |
| 262 |
'conf_order', |
| 263 |
[ |
| 264 |
'label' => __('Order', 'wpdirectorykit'), |
| 265 |
'type' => Controls_Manager::SELECT, |
| 266 |
'label_block' => true, |
| 267 |
'options' => [ |
| 268 |
'asc' => __('Ascending', 'wpdirectorykit'), |
| 269 |
'desc' => __('Descending', 'wpdirectorykit') |
| 270 |
], |
| 271 |
'default' => 'asc', |
| 272 |
'conditions' => [ |
| 273 |
'terms' => [ |
| 274 |
[ |
| 275 |
'name' => 'conf_results_type', |
| 276 |
'operator' => '==', |
| 277 |
'value' => 'results_categories', |
| 278 |
] |
| 279 |
], |
| 280 |
], |
| 281 |
] |
| 282 |
); |
| 283 |
|
| 284 |
|
| 285 |
$this->add_control( |
| 286 |
'complete_link_enable', |
| 287 |
[ |
| 288 |
'label' => __( 'Complete Link', 'wpdirectorykit' ), |
| 289 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 290 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 291 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 292 |
'return_value' => 'yes', |
| 293 |
'default' => '', |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
if(true){ |
| 298 |
$repeater = new Repeater(); |
| 299 |
$repeater->start_controls_tabs( 'categories' ); |
| 300 |
$repeater->add_control( |
| 301 |
'category_id', |
| 302 |
[ |
| 303 |
'label' => __( 'ID Category', 'wpdirectorykit' ), |
| 304 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 305 |
'min' => 1, |
| 306 |
'step' => 1, |
| 307 |
] |
| 308 |
); |
| 309 |
$repeater->end_controls_tabs(); |
| 310 |
|
| 311 |
|
| 312 |
$this->add_control( |
| 313 |
'conf_custom_results', |
| 314 |
[ |
| 315 |
'type' => Controls_Manager::REPEATER, |
| 316 |
'fields' => $repeater->get_controls(), |
| 317 |
'default' => [ |
| 318 |
], |
| 319 |
'title_field' => '{{{ category_id }}}', |
| 320 |
'conditions' => [ |
| 321 |
'terms' => [ |
| 322 |
[ |
| 323 |
'name' => 'conf_results_type', |
| 324 |
'operator' => '==', |
| 325 |
'value' => 'custom_categories', |
| 326 |
] |
| 327 |
], |
| 328 |
], |
| 329 |
] |
| 330 |
); |
| 331 |
|
| 332 |
} |
| 333 |
|
| 334 |
$this->end_controls_section(); |
| 335 |
|
| 336 |
} |
| 337 |
|
| 338 |
private function generate_controls_layout() { |
| 339 |
|
| 340 |
/* START Section t_options_slider */ |
| 341 |
if(true){ |
| 342 |
$this->start_controls_section( |
| 343 |
'tab_options_slider', |
| 344 |
[ |
| 345 |
'label' => esc_html__('Slider options', 'wpdirectorykit'), |
| 346 |
'tab' => 'tab_options', |
| 347 |
] |
| 348 |
); |
| 349 |
|
| 350 |
$this->add_responsive_control( |
| 351 |
'column_gap', |
| 352 |
[ |
| 353 |
'label' => esc_html__('Columns Gap', 'wpdirectorykit'), |
| 354 |
'type' => Controls_Manager::SLIDER, |
| 355 |
'default' => [ |
| 356 |
'size' => 0, |
| 357 |
], |
| 358 |
'range' => [ |
| 359 |
'px' => [ |
| 360 |
'min' => 0, |
| 361 |
'max' => 60, |
| 362 |
], |
| 363 |
], |
| 364 |
'selectors' => [ |
| 365 |
'{{WRAPPER}} .slick-slide' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};;', |
| 366 |
], |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
$this->add_responsive_control( |
| 371 |
'custom_width', |
| 372 |
[ |
| 373 |
'label' => esc_html__('Columns Custom Width', 'wpdirectorykit'), |
| 374 |
'type' => Controls_Manager::SLIDER, |
| 375 |
'default' => [ |
| 376 |
'size' => '', |
| 377 |
], |
| 378 |
'range' => [ |
| 379 |
'px' => [ |
| 380 |
'min' => 0, |
| 381 |
'max' => 1200, |
| 382 |
], |
| 383 |
], |
| 384 |
'selectors' => [ |
| 385 |
'{{WRAPPER}} .slick-slide .wdk-slider-item' => 'width: {{SIZE}}{{UNIT}} !important;', |
| 386 |
], |
| 387 |
] |
| 388 |
); |
| 389 |
|
| 390 |
$this->add_control( |
| 391 |
'layout_carousel_center', |
| 392 |
[ |
| 393 |
'label' => __( 'Center', 'wpdirectorykit' ), |
| 394 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 395 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 396 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 397 |
'return_value' => 'yes', |
| 398 |
'default' => '', |
| 399 |
] |
| 400 |
); |
| 401 |
|
| 402 |
$this->add_control( |
| 403 |
'layout_carousel_variableWidth', |
| 404 |
[ |
| 405 |
'label' => __( 'variableWidth', 'wpdirectorykit' ), |
| 406 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 407 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 408 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 409 |
'return_value' => 'yes', |
| 410 |
'default' => '', |
| 411 |
] |
| 412 |
); |
| 413 |
|
| 414 |
$this->add_control( |
| 415 |
'layout_carousel_is_infinite', |
| 416 |
[ |
| 417 |
'label' => __( 'Infinite', 'wpdirectorykit' ), |
| 418 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 419 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 420 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 421 |
'return_value' => 'true', |
| 422 |
'default' => 'true', |
| 423 |
] |
| 424 |
); |
| 425 |
|
| 426 |
$this->add_control( |
| 427 |
'layout_carousel_is_autoplay', |
| 428 |
[ |
| 429 |
'label' => __( 'Autoplay', 'wpdirectorykit' ), |
| 430 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 431 |
'label_on' => __( 'On', 'wpdirectorykit' ), |
| 432 |
'label_off' => __( 'Off', 'wpdirectorykit' ), |
| 433 |
'return_value' => 'true', |
| 434 |
'default' => '', |
| 435 |
] |
| 436 |
); |
| 437 |
|
| 438 |
$this->add_control( |
| 439 |
'layout_carousel_columns', |
| 440 |
[ |
| 441 |
'label' => __( 'Count grid', 'wpdirectorykit' ), |
| 442 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 443 |
'min' => 1, |
| 444 |
'max' => 10, |
| 445 |
'step' => 1, |
| 446 |
'default' => 1, |
| 447 |
] |
| 448 |
); |
| 449 |
|
| 450 |
$this->add_control( |
| 451 |
'layout_carousel_speed', |
| 452 |
[ |
| 453 |
'label' => __( 'Speed', 'wpdirectorykit' ), |
| 454 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 455 |
'min' => 0, |
| 456 |
'max' => 100000, |
| 457 |
'step' => 100, |
| 458 |
'default' => 500, |
| 459 |
] |
| 460 |
); |
| 461 |
$this->add_control( |
| 462 |
'layout_carousel_autoplaySpeed', |
| 463 |
[ |
| 464 |
'label' => __( 'Speed', 'wpdirectorykit' ), |
| 465 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 466 |
'min' => 0, |
| 467 |
'max' => 100000, |
| 468 |
'step' => 100, |
| 469 |
'default' => 500, |
| 470 |
] |
| 471 |
); |
| 472 |
|
| 473 |
$this->add_control( |
| 474 |
'layout_carousel_animation_style', |
| 475 |
[ |
| 476 |
'label' => __( 'Animation Style', 'wpdirectorykit' ), |
| 477 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 478 |
'default' => 'fade', |
| 479 |
'options' => [ |
| 480 |
'slide' => __( 'Slide', 'wpdirectorykit' ), |
| 481 |
'fade' => __( 'Fade', 'wpdirectorykit' ), |
| 482 |
'fade_in_in' => __( 'Fade in', 'wpdirectorykit' ), |
| 483 |
], |
| 484 |
] |
| 485 |
); |
| 486 |
|
| 487 |
$this->add_control( |
| 488 |
'layout_carousel_cssease', |
| 489 |
[ |
| 490 |
'label' => __( 'cssEase ', 'wpdirectorykit' ), |
| 491 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 492 |
'default' => 'linear', |
| 493 |
'options' => [ |
| 494 |
'linear' => __( 'linear', 'wpdirectorykit' ), |
| 495 |
'ease' => __( 'ease', 'wpdirectorykit' ), |
| 496 |
'ease-in' => __( 'ease-in', 'wpdirectorykit' ), |
| 497 |
'ease-out' => __( 'ease-out', 'wpdirectorykit' ), |
| 498 |
'ease-in-out' => __( 'ease-in-out', 'wpdirectorykit' ), |
| 499 |
'step-start' => __( 'step-start', 'wpdirectorykit' ), |
| 500 |
'step-end' => __( 'step-end', 'wpdirectorykit' ), |
| 501 |
], |
| 502 |
] |
| 503 |
); |
| 504 |
|
| 505 |
$this->end_controls_section(); |
| 506 |
} |
| 507 |
|
| 508 |
/* START Section t_options_slider */ |
| 509 |
if(true){ |
| 510 |
$this->start_controls_section( |
| 511 |
'tab_styles_image', |
| 512 |
[ |
| 513 |
'label' => esc_html__('Section Image', 'wpdirectorykit'), |
| 514 |
'tab' => Controls_Manager::TAB_STYLE, |
| 515 |
] |
| 516 |
); |
| 517 |
|
| 518 |
$this->add_responsive_control( |
| 519 |
't_styles_img_des_type', |
| 520 |
[ |
| 521 |
'label' => __( 'Design type ', 'wpdirectorykit' ), |
| 522 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 523 |
'default' => 'wdk-image_cover', |
| 524 |
'options' => [ |
| 525 |
'' => __( 'Default Sizes', 'wpdirectorykit' ), |
| 526 |
'wdk-image_size_cover' => __( 'Image auto crop/resize', 'wpdirectorykit' ), |
| 527 |
'wdk-image_cover' => __( 'Image cover (like background)', 'wpdirectorykit' ), |
| 528 |
], |
| 529 |
] |
| 530 |
); |
| 531 |
|
| 532 |
$this->add_responsive_control( |
| 533 |
't_styles_img_des_height', |
| 534 |
[ |
| 535 |
'label' => esc_html__('Height', 'wpdirectorykit'), |
| 536 |
'type' => Controls_Manager::SLIDER, |
| 537 |
'range' => [ |
| 538 |
'px' => [ |
| 539 |
'min' => 300, |
| 540 |
'max' => 1500, |
| 541 |
], |
| 542 |
], |
| 543 |
'render_type' => 'template', |
| 544 |
'default' => [ |
| 545 |
'size' => 350, |
| 546 |
], |
| 547 |
'selectors' => [ |
| 548 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini.wdk-image_cover .slick-list, |
| 549 |
{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini.wdk-image_size_cover .wdk-slider-item .wdk-slider-item_thumbnail' => 'height: {{SIZE}}px', |
| 550 |
], |
| 551 |
'separator' => 'after', |
| 552 |
'conditions' => [ |
| 553 |
'relation' => 'or', |
| 554 |
'terms' => [ |
| 555 |
[ |
| 556 |
'name' => 't_styles_img_des_type', |
| 557 |
'operator' => '==', |
| 558 |
'value' => 'wdk-image_size_cover', |
| 559 |
], |
| 560 |
[ |
| 561 |
'name' => 't_styles_img_des_type', |
| 562 |
'operator' => '==', |
| 563 |
'value' => 'wdk-image_cover', |
| 564 |
] |
| 565 |
], |
| 566 |
] |
| 567 |
] |
| 568 |
); |
| 569 |
$this->end_controls_section(); |
| 570 |
|
| 571 |
$this->start_controls_section( |
| 572 |
'tab_styles_arrows_section', |
| 573 |
[ |
| 574 |
'label' => esc_html__('Section Arrows', 'wpdirectorykit'), |
| 575 |
'tab' => Controls_Manager::TAB_STYLE, |
| 576 |
] |
| 577 |
); |
| 578 |
|
| 579 |
$this->add_responsive_control( |
| 580 |
't_styles_arrows_hide', |
| 581 |
[ |
| 582 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 583 |
'type' => Controls_Manager::SWITCHER, |
| 584 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 585 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 586 |
'return_value' => 'none', |
| 587 |
'default' => '', |
| 588 |
'selectors' => [ |
| 589 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows' => 'display: {{VALUE}};', |
| 590 |
], |
| 591 |
] |
| 592 |
); |
| 593 |
|
| 594 |
|
| 595 |
$this->add_responsive_control( |
| 596 |
't_styles_arrows_position', |
| 597 |
[ |
| 598 |
'label' => __( 'Position ', 'wpdirectorykit' ), |
| 599 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 600 |
'default' => 'wdk-categories-carousel_arrows_bottom', |
| 601 |
'options' => [ |
| 602 |
'wdk-categories-carousel_arrows_bottom' => __( 'Bottom', 'wpdirectorykit' ), |
| 603 |
'wdk-categories-carousel_arrows_middle' => __( 'Center', 'wpdirectorykit' ), |
| 604 |
'wdk-categories-carousel_arrows_top' => __( 'Top', 'wpdirectorykit' ), |
| 605 |
], |
| 606 |
] |
| 607 |
); |
| 608 |
|
| 609 |
$this->add_responsive_control( |
| 610 |
't_styles_arrows_position_style', |
| 611 |
[ |
| 612 |
'label' => __( 'Position Style', 'wpdirectorykit' ), |
| 613 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 614 |
'default' => 'wdk-categories-carousel_arrows_out', |
| 615 |
'options' => [ |
| 616 |
'wdk-categories-carousel_arrows_out' => __( 'Out', 'wpdirectorykit' ), |
| 617 |
'wdk-categories-carousel_arrows_in' => __( 'In', 'wpdirectorykit' ), |
| 618 |
], |
| 619 |
] |
| 620 |
); |
| 621 |
|
| 622 |
$this->add_responsive_control( |
| 623 |
't_styles_arrows_align', |
| 624 |
[ |
| 625 |
'label' => __( 'Align', 'wpdirectorykit' ), |
| 626 |
'type' => Controls_Manager::CHOOSE, |
| 627 |
'options' => [ |
| 628 |
'left' => [ |
| 629 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 630 |
'icon' => 'eicon-text-align-left', |
| 631 |
], |
| 632 |
'center' => [ |
| 633 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 634 |
'icon' => 'eicon-text-align-center', |
| 635 |
], |
| 636 |
'right' => [ |
| 637 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 638 |
'icon' => 'eicon-text-align-right', |
| 639 |
], |
| 640 |
'justify' => [ |
| 641 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 642 |
'icon' => 'eicon-text-align-justify', |
| 643 |
], |
| 644 |
], |
| 645 |
'render_type' => 'template', |
| 646 |
'selectors_dictionary' => [ |
| 647 |
'left' => 'justify-content: flex-start;', |
| 648 |
'center' => 'justify-content: center;', |
| 649 |
'right' => 'justify-content: flex-end;', |
| 650 |
'justify' => 'justify-content: space-between;', |
| 651 |
], |
| 652 |
'selectors' => [ |
| 653 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows' => '{{VALUE}};', |
| 654 |
], |
| 655 |
'conditions' => [ |
| 656 |
'relation' => 'or', |
| 657 |
'terms' => [ |
| 658 |
[ |
| 659 |
'name' => 't_styles_img_des_type', |
| 660 |
'operator' => '==', |
| 661 |
'value' => 'wdk-image_size_cover', |
| 662 |
], |
| 663 |
[ |
| 664 |
'name' => 't_styles_img_des_type', |
| 665 |
'operator' => '==', |
| 666 |
'value' => 'wdk-image_cover', |
| 667 |
] |
| 668 |
], |
| 669 |
], |
| 670 |
] |
| 671 |
); |
| 672 |
|
| 673 |
$this->add_responsive_control( |
| 674 |
'styles_carousel_arrows_icon_left_h', |
| 675 |
[ |
| 676 |
'label' => esc_html__('Arrow left', 'wpdirectorykit'), |
| 677 |
'type' => Controls_Manager::HEADING, |
| 678 |
'separator' => 'before', |
| 679 |
] |
| 680 |
); |
| 681 |
$selectors = array( |
| 682 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows .wdk-categories-carousel_arrow.wdk-slider-prev', |
| 683 |
); |
| 684 |
$this->generate_renders_tabs($selectors, 'styles_carousel_arrows_icon_left', ['margin']); |
| 685 |
|
| 686 |
$this->add_responsive_control( |
| 687 |
'styles_carousel_arrows_icon_left', |
| 688 |
[ |
| 689 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 690 |
'type' => Controls_Manager::ICONS, |
| 691 |
'label_block' => true, |
| 692 |
'default' => [ |
| 693 |
'value' => 'fa fa-angle-left', |
| 694 |
'library' => 'solid', |
| 695 |
], |
| 696 |
] |
| 697 |
); |
| 698 |
|
| 699 |
$this->add_responsive_control( |
| 700 |
'styles_carousel_arrows_icon_right_h', |
| 701 |
[ |
| 702 |
'label' => esc_html__('Arrow right', 'wpdirectorykit'), |
| 703 |
'type' => Controls_Manager::HEADING, |
| 704 |
'separator' => 'before', |
| 705 |
] |
| 706 |
); |
| 707 |
$selectors = array( |
| 708 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows .wdk-categories-carousel_arrow.wdk-slider-next', |
| 709 |
); |
| 710 |
$this->generate_renders_tabs($selectors, 'styles_carousel_arrows_icon_right', ['margin']); |
| 711 |
|
| 712 |
$this->add_responsive_control( |
| 713 |
'styles_carousel_arrows_icon_right', |
| 714 |
[ |
| 715 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 716 |
'type' => Controls_Manager::ICONS, |
| 717 |
'label_block' => true, |
| 718 |
'default' => [ |
| 719 |
'value' => 'fa fa-angle-right', |
| 720 |
'library' => 'solid', |
| 721 |
], |
| 722 |
] |
| 723 |
); |
| 724 |
|
| 725 |
$selectors = array( |
| 726 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows .wdk-categories-carousel_arrow', |
| 727 |
'hover'=>'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_arrows .wdk-categories-carousel_arrow%1$s' |
| 728 |
); |
| 729 |
$this->generate_renders_tabs($selectors, 't_styles_arrows_s', ['typo','color','background','border','border_radius','padding','shadow','transition']); |
| 730 |
|
| 731 |
$this->end_controls_section(); |
| 732 |
|
| 733 |
$this->start_controls_section( |
| 734 |
'tab_styles_dots_section', |
| 735 |
[ |
| 736 |
'label' => esc_html__('Section Dots', 'wpdirectorykit'), |
| 737 |
'tab' => Controls_Manager::TAB_STYLE, |
| 738 |
] |
| 739 |
); |
| 740 |
|
| 741 |
$this->add_responsive_control( |
| 742 |
't_styles_dots_hide', |
| 743 |
[ |
| 744 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 745 |
'type' => Controls_Manager::SWITCHER, |
| 746 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 747 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 748 |
'return_value' => 'none', |
| 749 |
'default' => '', |
| 750 |
'selectors' => [ |
| 751 |
'{{WRAPPER}} .wdk-categories-carousel .slick-dots' => 'display: {{VALUE}} !important;', |
| 752 |
], |
| 753 |
] |
| 754 |
); |
| 755 |
|
| 756 |
$this->add_responsive_control( |
| 757 |
't_styles_dots_position_style', |
| 758 |
[ |
| 759 |
'label' => __( 'Position Style', 'wpdirectorykit' ), |
| 760 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 761 |
'default' => 'wdk-categories-carousel_dots_out', |
| 762 |
'options' => [ |
| 763 |
'wdk-categories-carousel_dots_out' => __( 'Out', 'wpdirectorykit' ), |
| 764 |
'wdk-categories-carousel_dots_in' => __( 'In', 'wpdirectorykit' ), |
| 765 |
], |
| 766 |
] |
| 767 |
); |
| 768 |
|
| 769 |
$this->add_responsive_control( |
| 770 |
't_styles_dots_align', |
| 771 |
[ |
| 772 |
'label' => __( 'Position', 'wpdirectorykit' ), |
| 773 |
'type' => Controls_Manager::CHOOSE, |
| 774 |
'options' => [ |
| 775 |
'left' => [ |
| 776 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 777 |
'icon' => 'eicon-text-align-left', |
| 778 |
], |
| 779 |
'center' => [ |
| 780 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 781 |
'icon' => 'eicon-text-align-center', |
| 782 |
], |
| 783 |
'right' => [ |
| 784 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 785 |
'icon' => 'eicon-text-align-right', |
| 786 |
], |
| 787 |
'justify' => [ |
| 788 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 789 |
'icon' => 'eicon-text-align-justify', |
| 790 |
], |
| 791 |
], |
| 792 |
'render_type' => 'template', |
| 793 |
'selectors_dictionary' => [ |
| 794 |
'left' => 'justify-content: flex-start;', |
| 795 |
'center' => 'justify-content: center;', |
| 796 |
'right' => 'justify-content: flex-end;', |
| 797 |
'justify' => 'justify-content: space-between;', |
| 798 |
], |
| 799 |
'selectors' => [ |
| 800 |
'{{WRAPPER}} .wdk-categories-carousel .slick-dots' => '{{VALUE}};', |
| 801 |
], |
| 802 |
] |
| 803 |
); |
| 804 |
|
| 805 |
$this->add_responsive_control( |
| 806 |
'styles_carousel_dots_position_style', |
| 807 |
[ |
| 808 |
'label' => esc_html__('Icon', 'wpdirectorykit'), |
| 809 |
'type' => Controls_Manager::ICONS, |
| 810 |
'label_block' => true, |
| 811 |
'default' => [ |
| 812 |
'value' => 'fas fa-circle', |
| 813 |
'library' => 'solid', |
| 814 |
], |
| 815 |
] |
| 816 |
); |
| 817 |
|
| 818 |
$selectors = array( |
| 819 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .slick-dots li .wdk-dot', |
| 820 |
'hover'=>'{{WRAPPER}} .wdk-categories-carousel .slick-dots li .wdk-dot%1$s' |
| 821 |
); |
| 822 |
$this->generate_renders_tabs($selectors, 't_styles_dots__s', 'full', ['align']); |
| 823 |
|
| 824 |
$this->end_controls_section(); |
| 825 |
|
| 826 |
} |
| 827 |
|
| 828 |
} |
| 829 |
|
| 830 |
private function generate_controls_styles() { |
| 831 |
|
| 832 |
} |
| 833 |
|
| 834 |
private function generate_controls_content() { |
| 835 |
|
| 836 |
if(true){ |
| 837 |
$this->start_controls_section( |
| 838 |
'tab_content', |
| 839 |
[ |
| 840 |
'label' => esc_html__('Basic', 'wpdirectorykit'), |
| 841 |
'tab' => 'tab_content', |
| 842 |
] |
| 843 |
); |
| 844 |
|
| 845 |
$this->add_responsive_control( |
| 846 |
't_content_basic_position_y', |
| 847 |
[ |
| 848 |
'label' => __( 'Position Y', 'wpdirectorykit' ), |
| 849 |
'type' => Controls_Manager::CHOOSE, |
| 850 |
'options' => [ |
| 851 |
'top' => [ |
| 852 |
'title' => esc_html__( 'Top', 'wpdirectorykit' ), |
| 853 |
'icon' => 'eicon-text-align-left', |
| 854 |
], |
| 855 |
'center' => [ |
| 856 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 857 |
'icon' => 'eicon-text-align-center', |
| 858 |
], |
| 859 |
'bottom' => [ |
| 860 |
'title' => esc_html__( 'Bottom', 'wpdirectorykit' ), |
| 861 |
'icon' => 'eicon-text-align-right', |
| 862 |
], |
| 863 |
'justify' => [ |
| 864 |
'title' => esc_html__( 'Default', 'wpdirectorykit' ), |
| 865 |
'icon' => 'eicon-text-align-justify', |
| 866 |
], |
| 867 |
], |
| 868 |
'default' => 'left', |
| 869 |
'render_type' => 'template', |
| 870 |
'selectors_dictionary' => [ |
| 871 |
'top' => 'justify-content: flex-start;', |
| 872 |
'center' => 'justify-content: center;', |
| 873 |
'bottom' => 'justify-content: flex-end;', |
| 874 |
'justify' => 'justify-content: space-between;', |
| 875 |
], |
| 876 |
'selectors' => [ |
| 877 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item' => '{{VALUE}};', |
| 878 |
], |
| 879 |
] |
| 880 |
); |
| 881 |
|
| 882 |
$this->add_responsive_control( |
| 883 |
't_content_basic_position_x', |
| 884 |
[ |
| 885 |
'label' => __( 'Position X', 'wpdirectorykit' ), |
| 886 |
'type' => Controls_Manager::CHOOSE, |
| 887 |
'options' => [ |
| 888 |
'left' => [ |
| 889 |
'title' => esc_html__( 'Left', 'wpdirectorykit' ), |
| 890 |
'icon' => 'eicon-text-align-left', |
| 891 |
], |
| 892 |
'center' => [ |
| 893 |
'title' => esc_html__( 'Center', 'wpdirectorykit' ), |
| 894 |
'icon' => 'eicon-text-align-center', |
| 895 |
], |
| 896 |
'right' => [ |
| 897 |
'title' => esc_html__( 'Right', 'wpdirectorykit' ), |
| 898 |
'icon' => 'eicon-text-align-right', |
| 899 |
], |
| 900 |
'justify' => [ |
| 901 |
'title' => esc_html__( 'Justified', 'wpdirectorykit' ), |
| 902 |
'icon' => 'eicon-text-align-justify', |
| 903 |
], |
| 904 |
], |
| 905 |
'default' => 'left', |
| 906 |
'render_type' => 'template', |
| 907 |
'selectors_dictionary' => [ |
| 908 |
'left' => 'align-items: flex-start;', |
| 909 |
'center' => 'align-items: center;', |
| 910 |
'right' => 'align-items: flex-end;', |
| 911 |
'justify' => 'align-items: stretch;', |
| 912 |
], |
| 913 |
'selectors' => [ |
| 914 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item' => '{{VALUE}};', |
| 915 |
], |
| 916 |
] |
| 917 |
); |
| 918 |
|
| 919 |
$this->add_responsive_control( |
| 920 |
't_content_basic_link_text', |
| 921 |
[ |
| 922 |
'label' => __( 'Text of Link', 'wpdirectorykit' ), |
| 923 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 924 |
'default' => __( 'View', 'wpdirectorykit' ), |
| 925 |
] |
| 926 |
); |
| 927 |
|
| 928 |
$selectors = array( |
| 929 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-categories-carousel_mask', |
| 930 |
); |
| 931 |
$this->generate_renders_tabs($selectors, 't_content_basic_s', ['background']); |
| 932 |
|
| 933 |
$this->end_controls_section(); |
| 934 |
|
| 935 |
$this->start_controls_section( |
| 936 |
'tab_content_title', |
| 937 |
[ |
| 938 |
'label' => esc_html__('Title', 'wpdirectorykit'), |
| 939 |
'tab' => 'tab_content', |
| 940 |
] |
| 941 |
); |
| 942 |
$this->add_responsive_control( |
| 943 |
'tab_content_title_hide', |
| 944 |
[ |
| 945 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 946 |
'type' => Controls_Manager::SWITCHER, |
| 947 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 948 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 949 |
'return_value' => 'none', |
| 950 |
'default' => '', |
| 951 |
'selectors' => [ |
| 952 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_title' => 'display: {{VALUE}};', |
| 953 |
], |
| 954 |
] |
| 955 |
); |
| 956 |
$selectors = array( |
| 957 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_title', |
| 958 |
'hover'=>'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_title%1$s' |
| 959 |
); |
| 960 |
$this->generate_renders_tabs($selectors, 'tab_content_title_s', 'full'); |
| 961 |
$this->end_controls_section(); |
| 962 |
|
| 963 |
$this->start_controls_section( |
| 964 |
'tab_content_content', |
| 965 |
[ |
| 966 |
'label' => esc_html__('Content', 'wpdirectorykit'), |
| 967 |
'tab' => 'tab_content', |
| 968 |
] |
| 969 |
); |
| 970 |
$this->add_responsive_control( |
| 971 |
'tab_content_content_hide', |
| 972 |
[ |
| 973 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 974 |
'type' => Controls_Manager::SWITCHER, |
| 975 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 976 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 977 |
'return_value' => 'none', |
| 978 |
'default' => '', |
| 979 |
'selectors' => [ |
| 980 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_content' => 'display: {{VALUE}};', |
| 981 |
], |
| 982 |
] |
| 983 |
); |
| 984 |
$selectors = array( |
| 985 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_content', |
| 986 |
'hover'=>'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_content%1$s' |
| 987 |
); |
| 988 |
$this->generate_renders_tabs($selectors, 'tab_content_content_s', 'full'); |
| 989 |
$this->end_controls_section(); |
| 990 |
|
| 991 |
$this->start_controls_section( |
| 992 |
'tab_content_link', |
| 993 |
[ |
| 994 |
'label' => esc_html__('Link', 'wpdirectorykit'), |
| 995 |
'tab' => 'tab_content', |
| 996 |
] |
| 997 |
); |
| 998 |
$this->add_responsive_control( |
| 999 |
'tab_content_link_hide', |
| 1000 |
[ |
| 1001 |
'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ), |
| 1002 |
'type' => Controls_Manager::SWITCHER, |
| 1003 |
'none' => esc_html__( 'Hide', 'wpdirectorykit' ), |
| 1004 |
'block' => esc_html__( 'Show', 'wpdirectorykit' ), |
| 1005 |
'return_value' => 'none', |
| 1006 |
'default' => '', |
| 1007 |
'selectors' => [ |
| 1008 |
'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_link' => 'display: {{VALUE}};', |
| 1009 |
], |
| 1010 |
] |
| 1011 |
); |
| 1012 |
$selectors = array( |
| 1013 |
'normal' => '{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_link', |
| 1014 |
'hover'=>'{{WRAPPER}} .wdk-categories-carousel .wdk-categories-carousel_ini .wdk-slider-item_box_line .wdk-slider-item_box_link%1$s' |
| 1015 |
); |
| 1016 |
$this->generate_renders_tabs($selectors, 'tab_content_link_s', 'full'); |
| 1017 |
$this->end_controls_section(); |
| 1018 |
|
| 1019 |
} |
| 1020 |
} |
| 1021 |
|
| 1022 |
public function enqueue_styles_scripts() { |
| 1023 |
wp_enqueue_style('slick'); |
| 1024 |
wp_enqueue_style('slick-theme'); |
| 1025 |
wp_enqueue_script('slick'); |
| 1026 |
wp_enqueue_style('wdk-categories-carousel'); |
| 1027 |
} |
| 1028 |
|
| 1029 |
} |
| 1030 |
|