get_prefixed_hook( 'controllers/starts' ), [ &$this ] ); $this->start_controls_section( 'template_layout', [ 'label' => esc_html__( 'Template Style', 'absolute-addons' ) ] ); $styles = apply_filters( 'absp/widgets/fun-fact/styles', [ 'one' => esc_html__( 'One', 'absolute-addons' ), 'two' => esc_html__( 'Two', 'absolute-addons' ), 'three-pro' => esc_html__( 'Three (Pro)', 'absolute-addons' ), 'four' => esc_html__( 'Four', 'absolute-addons' ), 'five' => esc_html__( 'Five', 'absolute-addons' ), 'six-pro' => esc_html__( 'Six (Pro)', 'absolute-addons' ), 'seven-pro' => esc_html__( 'Seven (Pro)', 'absolute-addons' ), 'eight' => esc_html__( 'Eight', 'absolute-addons' ), 'nine-pro' => esc_html__( 'Nine (Pro)', 'absolute-addons' ), 'ten' => esc_html__( 'Ten', 'absolute-addons' ), ] ); $pro_styles = [ 'three-pro', 'six-pro', 'seven-pro', 'nine-pro', ]; $this->add_control( 'absolute_fun_fact', [ 'label' => esc_html__( 'Fun Fact Style', 'absolute-addons' ), 'type' => Absp_Control_Styles::TYPE, 'options' => $styles, 'default' => 'one', ] ); $this->init_pro_alert( $pro_styles ); $this->end_controls_section(); $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'absolute-addons' ) ] ); $this->add_control( 'fun_fact_icons', [ 'label' => esc_html__( 'Icon or SVG', 'absolute-addons' ), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'fas fa-heart', 'library' => 'solid', ], ] ); $this->add_control( 'fun_fact_title', [ 'label' => esc_html__( 'Title', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Fun Fact Title', 'absolute-addons' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_fun_fact', 'operator' => '!==', 'value' => 'four', ], [ 'name' => 'absolute_fun_fact', 'operator' => '!==', 'value' => 'six', ], ], ], ] ); //Fun fact sub title control $this->add_control( 'fun_fact_sub_title', [ 'label' => esc_html__( 'Sub Title', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Fun Fact Sub Title', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'one', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'ten', ], ], ], ] ); $this->add_control( 'fun_fact_number', [ 'label' => esc_html__( 'Counter Number', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '38,469', 'absolute-addons' ), ] ); $this->add_control( 'fun_fact_counter_suffix', [ 'label' => esc_html__( 'Counter Number Suffix', 'absolute-addons' ), 'type' => Controls_Manager::TEXT, 'placeholder' => esc_html__( 'Plus', 'absolute-addons' ), 'default' => esc_html__( '+', 'absolute-addons' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_fun_fact', 'operator' => '!==', 'value' => 'one', ], [ 'name' => 'absolute_fun_fact', 'operator' => '!==', 'value' => 'two', ], [ 'name' => 'absolute_fun_fact', 'operator' => '!==', 'value' => 'ten', ], ], ], ] ); $this->add_control( 'fun_fact_counter_number_speed', [ 'label' => esc_html__( 'Counter Number Speed', 'absolute-addons' ), 'type' => Controls_Manager::NUMBER, 'default' => esc_html__( '1500', 'absolute-addons' ), ] ); $this->add_control( 'content_align', [ 'label' => esc_html__( 'Text Alignment', 'absolute-addons' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'absolute-addons' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'absolute-addons' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'absolute-addons' ), 'icon' => 'fa fa-align-right', ], ], 'toggle' => true, ] ); $this->end_controls_section(); //Fun fact box button start $this->start_controls_section( 'fun_fact_button_control', array( 'label' => esc_html__( 'Button', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'one', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'two', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'four', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'six', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'nine', ], [ 'name' => 'absolute_fun_fact', 'operator' => '==', 'value' => 'ten', ], ], ], ) ); $this->add_control( 'enable_button', [ 'label' => esc_html__( 'Enable Button ?', 'absolute-addons' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Yes', 'absolute-addons'), 'label_off' => __('No', 'absolute-addons'), 'return_value' => 'yes', 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'fun_fact_button', [ 'label' => esc_html__( 'Button Text', 'absolute-addons' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Button Text', 'absolute-addons' ), 'condition' => [ 'enable_button' => 'yes', ], ] ); $this->add_control( 'fun_fact_button_url', [ 'label' => esc_html__( 'Button Link', 'absolute-addons' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_html__( 'https://your-link.com', 'absolute-addons' ), 'show_external' => true, 'default' => [ 'url' => '#', 'is_external' => false, 'nofollow' => false, ], 'condition' => [ 'enable_button' => 'yes', ], ] ); //Fun fact box button icon start $this->add_control( 'fun_fact_button_icon_switch', [ 'label' => esc_html__( 'Button Icon', 'absolute-addons' ), 'description' => esc_html__( '(If checked, icon will be show)', 'absolute-addons' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'absolute-addons' ), 'label_off' => esc_html__( 'Hide', 'absolute-addons' ), 'return_value' => 'button-icon', 'default' => '', 'separator' => 'before', 'condition' => [ 'enable_button' => 'yes', ], ] ); $this->add_control( 'fun_fact_button_icon', [ 'label' => esc_html__( 'Button Icon', 'absolute-addons' ), 'type' => Controls_Manager::ICONS, 'conditions' => [ 'terms' => [ [ 'name' => 'fun_fact_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], 'default' => [ 'value' => 'fas fa-angle-right', 'library' => 'solid', ], 'condition' => [ 'enable_button' => 'yes', ], ] ); $this->add_control( 'fun_fact_button_icon_position', array( 'label' => esc_html__( 'Button Icon Position', 'absolute-addons' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'before' => esc_html__( 'Before', 'absolute-addons' ), 'after' => esc_html__( 'After', 'absolute-addons' ), ), 'conditions' => [ 'terms' => [ [ 'name' => 'fun_fact_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], 'default' => 'after', 'condition' => [ 'enable_button' => 'yes', ], ) ); $this->add_responsive_control( 'fun_fact_button_icon_spacing', [ 'label' => esc_html__( 'Button Icon Spacing', 'absolute-addons' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'conditions' => [ 'terms' => [ [ 'name' => 'fun_fact_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], 'condition' => [ 'enable_button' => 'yes', ], 'selectors' => [ '{{WRAPPER}} .absp-wrapper .fun-fact-item .fun-fact-button-icon-after' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .absp-wrapper .fun-fact-item .fun-fact-button-icon-before' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); //Fun fact box button icon end $this->end_controls_section(); //Fun fact box button end $this->render_controller( 'style-controller-fun-fact-item-settings' ); $this->render_controller( 'style-controller-fun-fact-item-icon' ); $this->render_controller( 'style-controller-fun-fact-item-title' ); $this->render_controller( 'style-controller-fun-fact-item-sub-title' ); $this->render_controller( 'style-controller-fun-fact-item-counter-number' ); $this->render_controller( 'style-controller-fun-fact-item-separator' ); $this->render_controller( 'style-controller-fun-fact-item-separator-five' ); $this->render_controller( 'style-controller-fun-fact-item-button' ); /** * Fires after controllers are registered. * * @param Absoluteaddons_Style_Fun_Fact $this Current instance of WP_Network_Query (passed by reference). * * @since 1.0.0 * */ do_action_ref_array( $this->get_prefixed_hook( 'controllers/ends' ), [ &$this ] ); } /** * Render the widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.1.0 * * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_inline_editing_attributes( 'fun_fact_title' ); $this->add_render_attribute( 'fun_fact_title', 'class', 'fun-fact-title' ); $this->add_inline_editing_attributes( 'fun_fact_sub_title' ); $this->add_render_attribute( 'fun_fact_sub_title', 'class', 'fun-fact-sub-title' ); $this->add_inline_editing_attributes( 'fun_fact_counter_suffix' ); $this->add_render_attribute( 'fun_fact_counter_suffix', 'class', 'fun-fact-number-suffix' ); $this->add_inline_editing_attributes( 'fun_fact_button' ); $this->add_render_attribute( 'fun_fact_button', 'class', 'fun-fact-btn' ); if ( ! empty( $settings['fun_fact_button_url']['url'] ) ) { $this->add_link_attributes( 'fun_fact_button', $settings['fun_fact_button_url'] ); } $this->add_render_attribute( [ 'absp-fun-fact' => [ 'class' => 'fun-fact-count fun-fact-number', 'data-delay' => '10', 'data-time' => $settings['fun_fact_counter_number_speed'], ], ] ); ?>
render_template(); ?>
'; echo wp_get_attachment_image( $settings['fun_fact_icons']['value']['id'] ); echo '
'; } else { ?>
'; echo wp_get_attachment_image( $settings['fun_fact_button_icon']['value']['id'] ); echo ''; } else { ?> Placeholder Image
add_render_attribute( 'fun_fact_button', 'class', $class ); ?> print_render_attribute_string( 'fun_fact_button' ); ?> > '; echo wp_get_attachment_image( $settings['fun_fact_button_icon_only']['value']['id'] ); echo ''; } else { ?> Placeholder Image
render_fun_fact_button_icon( $settings ); ?>
render_fun_fact_button_icon( $settings ); ?>