widget_icon_classes('social-icons'); } /** * Get widget categories. * * Retrieve the list of categories the Social Icons widget belongs to. * * @since 1.0.0 * @access public * * @return array Widget categories. */ public function get_categories() { return [ 'ai-elements' ]; } public function get_style_depends() { return [ 'themify-icons', 'bootstrap-icons' ]; } public function get_help_url() { return 'https://aiaddons.ai/social-icons-demo/'; } /** * Register Social Icons widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { //Layouts Section $this->start_controls_section( 'layouts_section', [ 'label' => esc_html__( 'Layouts', 'ai-addons' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_responsive_control( 'text_align', [ 'label' => __( 'Alignment', 'ai-addons' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'ai-addons' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => __( 'Center', 'ai-addons' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => __( 'Right', 'ai-addons' ), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'ai-addons' ), 'icon' => 'eicon-text-align-justify', ], ], 'selectors' => [ '{{WRAPPER}} .social-icons-wrapper' => 'text-align: {{VALUE}};', ] ] ); $this->add_control( 'shape', [ 'label' => esc_html__( 'Shape', 'ai-addons' ), 'type' => Controls_Manager::SELECT, 'default' => 'circle', 'options' => [ 'rounded' => esc_html__( 'Rounded', 'ai-addons' ), 'square' => esc_html__( 'Square', 'ai-addons' ), 'circle' => esc_html__( 'Circle', 'ai-addons' ), ], 'prefix_class' => 'elementor-shape-', ] ); $this->add_responsive_control( 'columns', [ 'label' => esc_html__( 'Columns', 'ai-addons' ), 'type' => Controls_Manager::SELECT, 'default' => '0', 'options' => [ '0' => esc_html__( 'Auto', 'ai-addons' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'prefix_class' => 'elementor-grid%s-', 'selectors' => [ '{{WRAPPER}} .ai-social-icons' => '{{VALUE}}' ? 'grid-template-columns: repeat({{VALUE}}, auto);' : '', ], ] ); $this->end_controls_section(); //Icons Section $this->start_controls_section( 'icons_section', [ 'label' => esc_html__( 'Icons', 'ai-addons' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->add_control( 'social_icon', [ 'label' => __( 'Icon', 'ai-addons' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'social', 'default' => [ 'value' => 'fab fa-wordpress', 'library' => 'fa-brands', ], 'recommended' => [ 'fa-brands' => [ 'android', 'apple', 'behance', 'bitbucket', 'codepen', 'delicious', 'deviantart', 'digg', 'dribbble', 'elementor', 'facebook', 'flickr', 'foursquare', 'free-code-camp', 'github', 'gitlab', 'globe', 'houzz', 'instagram', 'jsfiddle', 'linkedin', 'medium', 'meetup', 'mix', 'mixcloud', 'odnoklassniki', 'pinterest', 'product-hunt', 'reddit', 'shopping-cart', 'skype', 'slideshare', 'snapchat', 'soundcloud', 'spotify', 'stack-overflow', 'steam', 'telegram', 'thumb-tack', 'tripadvisor', 'tumblr', 'twitch', 'twitter', 'viber', 'vimeo', 'vk', 'weibo', 'weixin', 'whatsapp', 'wordpress', 'xing', 'yelp', 'youtube', '500px', ], 'fa-solid' => [ 'envelope', 'link', 'rss', ], ], ] ); $repeater->add_control( 'link', [ 'label' => __( 'Link', 'ai-addons' ), 'type' => Controls_Manager::URL, 'default' => [ 'is_external' => 'true', ], 'dynamic' => [ 'active' => true, ], 'placeholder' => 'https://your-link.com', ] ); $repeater->add_control( 'link_color', [ 'label' => esc_html__( 'Color', 'ai-addons' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => esc_html__( 'Official Color', 'ai-addons' ), 'custom' => esc_html__( 'Custom', 'ai-addons' ), ], ] ); $repeater->add_control( 'link_primary_color', [ 'label' => esc_html__( 'Background Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'link_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.elementor-social-icon' => 'background-color: {{VALUE}};', ], ] ); $repeater->add_control( 'link_secondary_color', [ 'label' => esc_html__( 'Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'link_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.elementor-social-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}}.elementor-social-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'social_icon_list', [ 'label' => __( 'Social Icons', 'ai-addons' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'social_icon' => [ 'value' => 'fab fa-facebook', 'library' => 'fa-brands', ], ], [ 'social_icon' => [ 'value' => 'fab fa-twitter', 'library' => 'fa-brands', ], ], [ 'social_icon' => [ 'value' => 'fab fa-youtube', 'library' => 'fa-brands', ], ], ], 'title_field' => '<# var migrated = "undefined" !== typeof __fa4_migrated, social = ( "undefined" === typeof social ) ? false : social; #>{{{ elementor.helpers.getSocialNetworkNameFromIcon( social_icon, social, true, migrated, true ) }}}', ] ); $this->end_controls_section(); // Go premium section $this->start_controls_section( 'aiea_section_pro', [ 'label' => esc_html__( 'Go Premium for More Features', 'ai-addons' ) ] ); $this->add_control( 'aiea_get_pro', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => ' Get the Pro version for more ai elements and customization options.', 'content_classes' => 'ai-elementor-warning' ] ); $this->end_controls_section(); // Style General Section $this->start_controls_section( 'section_style_general', [ 'label' => __( 'General', 'ai-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'outer_margin', [ 'label' => esc_html__( 'Margin', 'ai-addons' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .social-icons-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'outer_padding', [ 'label' => esc_html__( 'Padding', 'ai-addons' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .social-icons-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_social_style', [ 'label' => __( 'Icon', 'ai-addons' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Color', 'ai-addons' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Official Color', 'ai-addons' ), 'custom' => __( 'Custom', 'ai-addons' ), ], ] ); $this->start_controls_tabs( 'icons_colors' ); $this->start_controls_tab( 'icon_color_normal', [ 'label' => esc_html__( 'Normal', 'ai-addons' ), ] ); $this->add_control( 'icon_primary_color', [ 'label' => __( 'Background Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} .elementor-social-icon' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'icon_secondary_color', [ 'label' => __( 'Icon Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} .elementor-social-icon i' => 'color: {{VALUE}};', '{{WRAPPER}} .elementor-social-icon svg' => 'fill: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', // We know this mistake - TODO: 'icon_border' (for hover control condition also) 'selector' => '{{WRAPPER}} .elementor-social-icon', ] ); $this->add_responsive_control( 'border_radius', [ 'label' => __( 'Border Radius', 'ai-addons' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'icon_color_hover', [ 'label' => esc_html__( 'Hover', 'ai-addons' ), ] ); $this->add_control( 'icon_primary_hcolor', [ 'label' => __( 'Background Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} .elementor-social-icon:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'icon_secondary_hcolor', [ 'label' => __( 'Icon Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon_color' => 'custom', ], 'selectors' => [ '{{WRAPPER}} .elementor-social-icon:hover i' => 'color: {{VALUE}};', '{{WRAPPER}} .elementor-social-icon:hover svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'hover_border_color', [ 'label' => __( 'Border Color', 'ai-addons' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'image_border_border!' => '', ], 'selectors' => [ '{{WRAPPER}} .elementor-social-icon:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'hover_animation', [ 'label' => esc_html__( 'Hover Animation', 'ai-addons' ), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'icon_size', [ 'label' => __( 'Size', 'ai-addons' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 6, 'max' => 300, ], ], 'selectors' => [ '{{WRAPPER}}' => '--icon-size: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'icon_padding', [ 'label' => __( 'Padding', 'ai-addons' ), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} .elementor-social-icon' => '--icon-padding: {{SIZE}}{{UNIT}}', ], 'default' => [ 'unit' => 'px', ], 'tablet_default' => [ 'unit' => 'px', ], 'mobile_default' => [ 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], ] ); $this->add_responsive_control( 'icon_spacing', [ 'label' => __( 'Spacing', 'ai-addons' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 5, ], 'selectors' => [ '{{WRAPPER}} .ai-social-icons > li > a' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .ai-social-icons' => 'margin-left: -{{SIZE}}{{UNIT}}; margin-right: -{{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'row_gap', [ 'label' => __( 'Rows Gap', 'ai-addons' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'selectors' => [ '{{WRAPPER}} .ai-social-icons > li' => 'margin-bottom: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ai-social-icons' => 'margin-bottom: -{{SIZE}}{{UNIT}};' ], ] ); $this->end_controls_section(); } /** * Render Social Icons widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); extract( $settings ); $link_target = isset( $link_target ) && $link_target == 'yes' ? '_blank' : '_self'; $class_animation = ''; if ( ! empty( $settings['hover_animation'] ) ) { $class_animation = 'elementor-animation-' . $settings['hover_animation']; } echo '
'; } }