templates
4 months ago
Accordion.php
9 months ago
Alerts_Box.php
9 months ago
Blog_Grid.php
6 months ago
Cheat_Sheet.php
6 months ago
Counter.php
6 months ago
Dynamic_Faq.php
1 month ago
Icon_Box.php
6 months ago
Integrations.php
6 months ago
List_Item.php
9 months ago
Tabs.php
6 months ago
Team_Carousel.php
6 months ago
Testimonial.php
6 months ago
Timeline.php
9 months ago
Video_Playlist.php
6 months ago
Video_Popup.php
6 months ago
Team_Carousel.php
361 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Group_Control_Typography; |
| 9 | use Elementor\Widget_Base; |
| 10 | use Elementor\Controls_Manager; |
| 11 | |
| 12 | // Exit if accessed directly |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Class Team |
| 19 | * |
| 20 | * @package spider\Widgets |
| 21 | * @since 1.0.0 |
| 22 | */ |
| 23 | class Team_Carousel extends Widget_Base { |
| 24 | |
| 25 | public function get_name() { |
| 26 | return 'docy_team_carousel'; // ID of the widget (Don't change this name) |
| 27 | } |
| 28 | |
| 29 | public function get_title() { |
| 30 | return esc_html__( 'Team Carousel', 'spider-elements' ); |
| 31 | } |
| 32 | |
| 33 | public function get_icon() { |
| 34 | return 'eicon-nested-carousel spel-icon'; |
| 35 | } |
| 36 | |
| 37 | public function get_keywords() { |
| 38 | return [ 'spider', 'spider elements', 'team', 'team', 'team widget' ]; |
| 39 | } |
| 40 | |
| 41 | public function get_categories() { |
| 42 | return [ 'spider-elements' ]; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Name: get_style_depends() |
| 47 | * Desc: Register the required CSS dependencies for the frontend. |
| 48 | */ |
| 49 | public function get_style_depends() { |
| 50 | return [ 'elegant-icon', 'slick', 'slick-theme', 'spel-main' ]; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Name: get_script_depends() |
| 55 | * Desc: Register the required JS dependencies for the frontend. |
| 56 | */ |
| 57 | public function get_script_depends() { |
| 58 | return [ 'slick', 'spel-el-widgets' ]; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | /** |
| 63 | * Name: register_controls() |
| 64 | * Desc: Register controls for these widgets |
| 65 | * Params: no params |
| 66 | * Return: @void |
| 67 | * Since: @1.0.0 |
| 68 | * Package: @spider-elements |
| 69 | * Author: spider-themes |
| 70 | */ |
| 71 | protected function register_controls() { |
| 72 | $this->elementor_content_control(); |
| 73 | $this->team_slider_control(); |
| 74 | $this->team_style_control(); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Name: elementor_content_control() |
| 80 | * Desc: Register the Content Tab output on the Elementor editor. |
| 81 | * Params: no params |
| 82 | * Return: @void |
| 83 | * Since: @1.0.0 |
| 84 | * Package: @spider-elements |
| 85 | * Author: spider-themes |
| 86 | */ |
| 87 | |
| 88 | public function elementor_content_control() { |
| 89 | |
| 90 | // ============================ Select Style ===========================// |
| 91 | $this->start_controls_section( |
| 92 | 'select_style', |
| 93 | [ |
| 94 | 'label' => esc_html__( 'Preset Skins', 'spider-elements' ), |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | $this->add_control( |
| 99 | 'style', |
| 100 | [ |
| 101 | 'label' => esc_html__( 'Team Style', 'spider-elements' ), |
| 102 | 'type' => Controls_Manager::CHOOSE, |
| 103 | 'options' => [ |
| 104 | '1' => [ |
| 105 | 'icon' => 'team1', |
| 106 | 'title' => esc_html__( '01 : Team Carousel', 'spider-elements' ) |
| 107 | ], |
| 108 | '2' => [ |
| 109 | 'icon' => 'team2', |
| 110 | 'title' => esc_html__( '02 : Team Carousel', 'spider-elements' ), |
| 111 | ] |
| 112 | ], |
| 113 | 'default' => '1', |
| 114 | ] |
| 115 | ); |
| 116 | |
| 117 | |
| 118 | $this->end_controls_section(); // End Select Style |
| 119 | } |
| 120 | |
| 121 | public function team_slider_control() { |
| 122 | //start content layout |
| 123 | $this->start_controls_section( |
| 124 | 'section_title_control', |
| 125 | [ |
| 126 | 'label' => esc_html__( 'Content', 'spider-elements' ), |
| 127 | ] |
| 128 | ); |
| 129 | |
| 130 | //================= Team Slider Item =================// |
| 131 | $repeater = new \Elementor\Repeater(); |
| 132 | $repeater->add_control( |
| 133 | 'team_slider_image', [ |
| 134 | 'label' => esc_html__( 'Slider Image', 'spider-elements' ), |
| 135 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 136 | 'default' => [ |
| 137 | 'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 138 | ], |
| 139 | ] |
| 140 | ); |
| 141 | |
| 142 | $repeater->add_control( |
| 143 | 'team_name', [ |
| 144 | 'label' => esc_html__( 'Name', 'spider-elements' ), |
| 145 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 146 | 'placeholder' => esc_html__( 'Enter Name', 'spider-elements' ), |
| 147 | 'default' => esc_html__( 'John Deo', 'spider-elements' ), |
| 148 | 'label_block' => true, |
| 149 | ] |
| 150 | ); |
| 151 | |
| 152 | $repeater->add_control( |
| 153 | 'team_link', |
| 154 | [ |
| 155 | 'label' => esc_html__( 'Link', 'spider-elements' ), |
| 156 | 'type' => \Elementor\Controls_Manager::URL, |
| 157 | 'placeholder' => esc_html__( 'https://your-link.com', 'spider-elements' ), |
| 158 | 'options' => [ 'url', 'is_external', 'nofollow' ], |
| 159 | 'default' => [ |
| 160 | 'url' => '', |
| 161 | 'is_external' => true, |
| 162 | 'nofollow' => true, |
| 163 | // 'custom_attributes' => '', |
| 164 | ], |
| 165 | 'label_block' => true, |
| 166 | ] |
| 167 | ); |
| 168 | |
| 169 | $repeater->add_control( |
| 170 | 'team_job_position', [ |
| 171 | 'label' => esc_html__( 'Content Text', 'spider-elements' ), |
| 172 | 'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 173 | 'placeholder' => esc_html__( 'Enter text', 'spider-elements' ), |
| 174 | 'default' => esc_html__( 'Envato Customer', 'spider-elements' ), |
| 175 | 'label_block' => true, |
| 176 | ] |
| 177 | ); |
| 178 | |
| 179 | $this->add_control( |
| 180 | 'team_slider_item', |
| 181 | [ |
| 182 | 'label' => esc_html__( 'Team Item', 'spider-elements' ), |
| 183 | 'type' => \Elementor\Controls_Manager::REPEATER, |
| 184 | 'fields' => $repeater->get_controls(), |
| 185 | 'prevent_empty' => false, |
| 186 | 'default' => [ |
| 187 | [ |
| 188 | 'team_name' => esc_html__( 'Elizabeth Foster', 'spider-elements' ), |
| 189 | 'team_job_position' => esc_html__( 'UI/UX Designer', 'spider-elements' ), |
| 190 | ], |
| 191 | [ |
| 192 | 'team_name' => esc_html__( 'Julie Ake', 'spider-elements' ), |
| 193 | 'team_job_position' => esc_html__( 'Product Designer', 'spider-elements' ), |
| 194 | ], |
| 195 | [ |
| 196 | 'team_name' => esc_html__( 'Elizabeth Foster', 'spider-elements' ), |
| 197 | 'team_job_position' => esc_html__( 'UI/UX Designer', 'spider-elements' ), |
| 198 | ], |
| 199 | [ |
| 200 | 'team_name' => esc_html__( 'Juan Marko', 'spider-elements' ), |
| 201 | 'team_job_position' => esc_html__( 'Java Developer', 'spider-elements' ), |
| 202 | ], |
| 203 | |
| 204 | ], |
| 205 | ] |
| 206 | ); |
| 207 | $this->end_controls_section(); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | /** |
| 212 | * Name: elementor_style_control() |
| 213 | * Desc: Register the Style Tab output on the Elementor editor. |
| 214 | * Params: no params |
| 215 | * Return: @void |
| 216 | * Since: @1.0.0 |
| 217 | * Package: @spider-elements |
| 218 | * Author: spider-themes |
| 219 | */ |
| 220 | public function team_style_control() { |
| 221 | |
| 222 | $this->start_controls_section( |
| 223 | 'team_img_style', [ |
| 224 | 'label' => esc_html__( 'Team Image', 'spider-elements' ), |
| 225 | 'tab' => Controls_Manager::TAB_STYLE, |
| 226 | 'condition' => [ |
| 227 | 'style' => [ '1' ] |
| 228 | ] |
| 229 | ] |
| 230 | ); |
| 231 | |
| 232 | $this->add_responsive_control( |
| 233 | 'team_img_border_radius', |
| 234 | [ |
| 235 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 236 | 'type' => Controls_Manager::DIMENSIONS, |
| 237 | 'size_units' => [ 'px', '%', 'em' ], |
| 238 | 'selectors' => [ |
| 239 | '{{WRAPPER}} .card-style-three .img-meta img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 240 | ], |
| 241 | ] |
| 242 | ); |
| 243 | |
| 244 | $this->end_controls_section(); |
| 245 | |
| 246 | |
| 247 | //========================= Contents =========================// |
| 248 | $this->start_controls_section( |
| 249 | 'team_style_content', [ |
| 250 | 'label' => esc_html__( 'Team Contents', 'spider-elements' ), |
| 251 | 'tab' => Controls_Manager::TAB_STYLE, |
| 252 | ] |
| 253 | ); |
| 254 | |
| 255 | $this->add_control( |
| 256 | 'name_heading', [ |
| 257 | 'label' => esc_html__( 'Name', 'spider-elements' ), |
| 258 | 'type' => Controls_Manager::HEADING, |
| 259 | ] |
| 260 | ); |
| 261 | |
| 262 | $this->start_controls_tabs( |
| 263 | 'style_team_title_tabs' |
| 264 | ); |
| 265 | |
| 266 | //=== Normal icon |
| 267 | $this->start_controls_tab( |
| 268 | 'style_normal', |
| 269 | [ |
| 270 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 271 | ] |
| 272 | ); |
| 273 | |
| 274 | $this->add_group_control( |
| 275 | Group_Control_Typography::get_type(), [ |
| 276 | 'name' => 'team_name_typo', |
| 277 | 'selector' => '{{WRAPPER}} .card-style-three .name,{{WRAPPER}} .card-style-eight .name', |
| 278 | ] |
| 279 | ); //End Author Name |
| 280 | $this->add_control( |
| 281 | 'team_name_color', [ |
| 282 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 283 | 'type' => Controls_Manager::COLOR, |
| 284 | 'selectors' => [ |
| 285 | '{{WRAPPER}} .card-style-three .name,{{WRAPPER}} .card-style-eight .name' => 'color: {{VALUE}};', |
| 286 | ], |
| 287 | ] |
| 288 | ); |
| 289 | |
| 290 | $this->end_controls_tab(); //End Normal icon |
| 291 | |
| 292 | //=== Active icon |
| 293 | $this->start_controls_tab( |
| 294 | 'team_title_hover', [ |
| 295 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 296 | ] |
| 297 | ); |
| 298 | |
| 299 | $this->add_control( |
| 300 | 'team_name_hover_color', [ |
| 301 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 302 | 'type' => Controls_Manager::COLOR, |
| 303 | 'selectors' => [ |
| 304 | '{{WRAPPER}} .card-style-three .name:hover,{{WRAPPER}} .card-style-eight .name:hover' => 'color: {{VALUE}};', |
| 305 | ], |
| 306 | ] |
| 307 | ); |
| 308 | |
| 309 | $this->end_controls_tab(); // End Active Tab Title |
| 310 | $this->end_controls_tabs(); // End Accordion icon Normal/Active/ State |
| 311 | |
| 312 | $this->add_control( |
| 313 | 'designation_heading', [ |
| 314 | 'label' => esc_html__( 'Designation', 'spider-elements' ), |
| 315 | 'type' => Controls_Manager::HEADING, |
| 316 | 'separator' => 'before', |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | $this->add_group_control( |
| 321 | Group_Control_Typography::get_type(), [ |
| 322 | 'name' => 'team_position_typo', |
| 323 | 'selector' => '{{WRAPPER}} .card-style-three .post,{{WRAPPER}} .card-style-eight .post', |
| 324 | ] |
| 325 | ); //End Author Name |
| 326 | $this->add_control( |
| 327 | 'team_position_color', [ |
| 328 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 329 | 'type' => Controls_Manager::COLOR, |
| 330 | 'selectors' => [ |
| 331 | '{{WRAPPER}} .card-style-three .post,{{WRAPPER}} .card-style-eight .post' => 'color: {{VALUE}};', |
| 332 | ], |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | |
| 337 | $this->end_controls_section(); |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Name: elementor_render() |
| 342 | * Desc: Render the widget output on the frontend. |
| 343 | * Params: no params |
| 344 | * Return: @void |
| 345 | * Since: @1.0.0 |
| 346 | * Package: @spider-elements |
| 347 | * Author: spider-themes |
| 348 | */ |
| 349 | protected function render() { |
| 350 | $settings = $this->get_settings_for_display(); |
| 351 | extract( $settings ); //extract all settings array to variables converted to name of key |
| 352 | $team_id = $this->get_id(); |
| 353 | //================= Template Parts =================// |
| 354 | // Whitelist valid style values to prevent Local File Inclusion |
| 355 | $allowed_styles = array( '1', '2' ); |
| 356 | $style = isset( $settings['style'] ) && in_array( $settings['style'], $allowed_styles, true ) ? $settings['style'] : '1'; |
| 357 | include __DIR__ . "/templates/team/team-{$style}.php"; |
| 358 | } |
| 359 | |
| 360 | |
| 361 | } |