templates
2 years ago
Accordion.php
2 years ago
Alerts_Box.php
2 years ago
Animated_Heading.php
2 years ago
Before_after.php
2 years ago
Blog_Grid.php
2 years ago
Buttons.php
2 years ago
Cheat_sheet.php
2 years ago
Counter.php
2 years ago
Fullscreen_Slider.php
2 years ago
Icon_box.php
2 years ago
Instagram.php
2 years ago
Integrations.php
2 years ago
List_Item.php
2 years ago
Marquee_Slides.php
2 years ago
Pricing_Table_Switcher.php
2 years ago
Pricing_Table_Tabs.php
2 years ago
Skill_Showcase.php
2 years ago
Tabs.php
2 years ago
Team_Carousel.php
2 years ago
Testimonial.php
2 years ago
Timeline.php
2 years ago
Video_Playlist.php
2 years ago
Video_Popup.php
2 years ago
Skill_Showcase.php
210 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Widget_Base; |
| 9 | use Elementor\Controls_Manager; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | use Elementor\Repeater; |
| 12 | |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Class Skill_Showcase |
| 21 | * @package spider\Widgets |
| 22 | */ |
| 23 | class Skill_Showcase extends Widget_Base { |
| 24 | |
| 25 | public function get_name() { |
| 26 | return 'spe_skill_showcase_widget'; // ID of the widget (Don't change this name) |
| 27 | } |
| 28 | |
| 29 | public function get_title() { |
| 30 | return __( 'Skill Showcase', 'spider-elements' ); |
| 31 | } |
| 32 | |
| 33 | public function get_icon() { |
| 34 | return 'eicon-woo-settings spel-icon'; |
| 35 | } |
| 36 | |
| 37 | public function get_categories() { |
| 38 | return [ 'spider-elements' ]; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Name: get_style_depends() |
| 43 | * Desc: Register the required CSS dependencies for the frontend. |
| 44 | */ |
| 45 | public function get_style_depends() { |
| 46 | return [ 'spel-main' ]; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Name: register_controls() |
| 51 | * Desc: Register controls for these widgets |
| 52 | * Params: no params |
| 53 | * Return: @void |
| 54 | * Since: @1.0.0 |
| 55 | * Package: @spider-elements |
| 56 | * Author: spider-themes |
| 57 | */ |
| 58 | protected function register_controls() { |
| 59 | $this->elementor_content_control(); |
| 60 | $this->elementor_style_control(); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * Name: elementor_content_control() |
| 66 | * Desc: Register the Content Tab output on the Elementor editor. |
| 67 | * Params: no params |
| 68 | * Return: @void |
| 69 | * Since: @1.0.0 |
| 70 | * Package: @spider-elements |
| 71 | * Author: spider-themes |
| 72 | */ |
| 73 | public function elementor_content_control() { |
| 74 | |
| 75 | //=================== Skill Showcase Text ===================// |
| 76 | $this->start_controls_section( |
| 77 | 'section_skills', |
| 78 | [ |
| 79 | 'label' => __( 'Skills', 'spider-elements' ), |
| 80 | ] |
| 81 | ); |
| 82 | |
| 83 | $repeater = new Repeater(); |
| 84 | |
| 85 | $repeater->add_control( |
| 86 | 'name', |
| 87 | [ |
| 88 | 'label' => __( 'Skill Name', 'spider-elements' ), |
| 89 | 'type' => Controls_Manager::TEXT, |
| 90 | 'default' => __( 'Skill Name', 'spider-elements' ), |
| 91 | 'label_block' => true, |
| 92 | ] |
| 93 | ); |
| 94 | |
| 95 | $repeater->add_control( |
| 96 | 'size', |
| 97 | [ |
| 98 | 'label' => __( 'Size', 'spider-elements' ), |
| 99 | 'type' => Controls_Manager::SELECT, |
| 100 | 'options' => [ |
| 101 | 'default' => __( 'Default', 'spider-elements' ), |
| 102 | 'small' => __( 'Small', 'spider-elements' ), |
| 103 | 'big' => __( 'Big', 'spider-elements' ), |
| 104 | ], |
| 105 | 'default' => 'default', |
| 106 | ] |
| 107 | ); |
| 108 | |
| 109 | $this->add_control( |
| 110 | 'skills_list', |
| 111 | [ |
| 112 | 'label' => __( 'Skills List', 'spider-elements' ), |
| 113 | 'type' => Controls_Manager::REPEATER, |
| 114 | 'fields' => $repeater->get_controls(), |
| 115 | 'default' => [ |
| 116 | [ |
| 117 | 'name' => __( 'Html', 'spider-elements' ), |
| 118 | 'size' => 'default', |
| 119 | ], |
| 120 | [ |
| 121 | 'name' => __( 'Css', 'spider-elements' ), |
| 122 | 'size' => 'default', |
| 123 | ], |
| 124 | [ |
| 125 | 'name' => __( 'Java', 'spider-elements' ), |
| 126 | 'size' => 'default', |
| 127 | ] |
| 128 | ], |
| 129 | 'title_field' => '{{{ name }}}', |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $this->end_controls_section(); |
| 134 | } //End Skill Showcase Text |
| 135 | |
| 136 | |
| 137 | /** |
| 138 | * Name: elementor_style_control() |
| 139 | * Desc: Register the Style Tab output on the Elementor editor. |
| 140 | * Params: no params |
| 141 | * Return: @void |
| 142 | * Since: @1.0.0 |
| 143 | * Package: @spider-elements |
| 144 | * Author: spider-themes |
| 145 | */ |
| 146 | public function elementor_style_control() { |
| 147 | |
| 148 | //============================= Skill Showcase Style =============================// |
| 149 | $this->start_controls_section( |
| 150 | 'skill_showcase_text', [ |
| 151 | 'label' => esc_html__( 'Skill Showcase', 'spider-elements' ), |
| 152 | 'tab' => Controls_Manager::TAB_STYLE, |
| 153 | ] |
| 154 | ); |
| 155 | |
| 156 | $this->add_control( |
| 157 | 'skill_text_color', |
| 158 | [ |
| 159 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 160 | 'type' => Controls_Manager::COLOR, |
| 161 | 'selectors' => [ |
| 162 | '{{WRAPPER}} .skill-showcase span' => 'color: {{VALUE}};', |
| 163 | ], |
| 164 | ] |
| 165 | ); |
| 166 | |
| 167 | $this->add_group_control( |
| 168 | Group_Control_Typography::get_type(), [ |
| 169 | 'name' => 'showcase_text_typography', |
| 170 | 'selector' => '{{WRAPPER}} .skill-showcase span', |
| 171 | ] |
| 172 | ); |
| 173 | |
| 174 | $this->end_controls_section(); |
| 175 | |
| 176 | } //End Skill Showcase style |
| 177 | |
| 178 | |
| 179 | /** |
| 180 | * Name: elementor_render() |
| 181 | * Desc: Render the widget output on the frontend. |
| 182 | * Params: no params |
| 183 | * Return: @void |
| 184 | * Since: @1.0.0 |
| 185 | * Package: @spider-elements |
| 186 | * Author: spider-themes |
| 187 | */ |
| 188 | protected function render() { |
| 189 | $settings = $this->get_settings_for_display(); |
| 190 | |
| 191 | if ( empty( $settings['skills_list'] ) ) { |
| 192 | return; |
| 193 | } |
| 194 | |
| 195 | echo '<div class="col-lg-5 offset-lg-2 col-md-6 text-end wow fadeInRight">'; |
| 196 | echo '<div class="skill-showcase">'; |
| 197 | foreach ( $settings['skills_list'] as $skill ) { |
| 198 | if ( $skill['size'] === 'default' ) { |
| 199 | echo '<span>' . esc_html( $skill['name'] ) . '</span>'; |
| 200 | } elseif ( $skill['size'] === 'small' ) { |
| 201 | echo '<span class="small">' . esc_html( $skill['name'] ) . '</span>'; |
| 202 | } elseif ( $skill['size'] === 'big' ) { |
| 203 | echo '<span class="big">' . esc_html( $skill['name'] ) . '</span>'; |
| 204 | } |
| 205 | } |
| 206 | echo '</div>'; |
| 207 | echo '</div>'; |
| 208 | } |
| 209 | |
| 210 | } |