get_prefixed_hook( 'controllers/starts' ), [ &$this ] ); $this->start_controls_section( 'template_layout', [ 'label' => esc_html__( 'Template Style', 'absolute-addons' ) ] ); $styles = apply_filters( 'absp/widgets/content-card/styles', [ 'one' => esc_html__( 'One', 'absolute-addons' ), 'two' => esc_html__( 'Two', 'absolute-addons' ), 'three' => esc_html__( 'Three', 'absolute-addons' ), 'four-pro' => esc_html__( 'Four (Pro)', 'absolute-addons' ), 'five-pro' => esc_html__( 'Five (Pro)', 'absolute-addons' ), 'six-pro' => esc_html__( 'Six (Pro)', 'absolute-addons' ), 'seven' => esc_html__( 'Seven', 'absolute-addons' ), 'eight-pro' => esc_html__( 'Eight (Pro)', 'absolute-addons' ), 'nine' => esc_html__( 'Nine', 'absolute-addons' ), 'ten' => esc_html__( 'Ten', 'absolute-addons' ), 'eleven-pro' => esc_html__( 'Eleven (Pro)', 'absolute-addons' ), 'twelve-pro' => esc_html__( 'Twelve (Pro)', 'absolute-addons' ), 'thirteen' => esc_html__( 'Thirteen', 'absolute-addons' ), 'fourteen-pro' => esc_html__( 'Fourteen (Pro)', 'absolute-addons' ), 'fifteen' => esc_html__( 'Fifteen', 'absolute-addons' ), 'sixteen' => esc_html__( 'Sixteen', 'absolute-addons' ), 'seventeen-pro' => esc_html__( 'Seventeen (Pro)', 'absolute-addons' ), 'eighteen-pro' => esc_html__( 'Eighteen (Pro)', 'absolute-addons' ), ] ); $pro_styles = [ 'four-pro', 'five-pro', 'six-pro', 'eight-pro', 'eleven-pro', 'twelve-pro', 'fourteen-pro', 'seventeen-pro', 'eighteen-pro', ]; $this->add_control( 'absolute_content_card', [ 'label' => esc_html__( 'Content Card 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( 'content_card_box_image', [ 'label' => esc_html__( 'Add Image', 'absolute-addons' ), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $this->add_control( 'content_card_img_hover_animation', [ 'label' => esc_html__( 'Image Hover Animation?', 'absolute-addons' ), 'type' => Controls_Manager::SWITCHER, 'enable' => esc_html__( 'Yes', 'absolute-addons' ), 'disable' => esc_html__( 'No', 'absolute-addons' ), 'return_value' => 'enable', 'default' => 'enable', 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], ], ], ] ); $this->add_control( 'content_card_box_brand_logo_five', [ 'label' => esc_html__( 'Add Brand Logo', 'absolute-addons' ), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'absolute_content_card' => 'five', ], ] ); $this->add_control( 'content_card_box_title', [ 'label' => esc_html__( 'Title', 'absolute-addons' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Content Card Title', 'absolute-addons' ), ] ); $this->add_control( 'content_card_box_sub_title', [ 'label' => esc_html__( 'Sub Title', 'absolute-addons' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Content Card Sub Title', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'one', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'four', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'five', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'six', ], ], ], ] ); $this->add_control( 'content_card_box_sub_title_two', [ 'label' => esc_html__( 'Sub Title', 'absolute-addons' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => sprintf( '%s', __( 'THE INSPIRATION', 'absolute-addons' ) ), 'condition' => [ 'absolute_content_card' => 'two', ], ] ); $this->add_control( 'content_card_box_sub_title_fifteen', [ 'label' => esc_html__( 'Sub Title', 'absolute-addons' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => sprintf( '%s', __( 'THE INSPIRATION', 'absolute-addons' ) ), 'condition' => [ 'absolute_content_card' => 'fifteen', ], ] ); $this->add_control( 'content_card_box_brand_name_five', [ 'label' => esc_html__( 'Brand Name', 'absolute-addons' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'swatch', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'five', ], ] ); $this->add_control( 'content_card_box_content', [ 'label' => esc_html__( 'Content', 'absolute-addons' ), 'type' => Controls_Manager::WYSIWYG, 'default' => sprintf( '

%s

', __( 'Content Card Description Enter Here', 'absolute-addons' ) ), 'show_label' => false, 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'six', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'eight', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'thirteen', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'thirteen', ], ], ], ] ); $this->add_control( 'content_card_image_background_style', array( 'label' => esc_html__( 'Select Image Background Shape', 'absolute-addons' ), 'type' => Controls_Manager::SELECT, 'options' => array( 'style1' => esc_html__( 'Shape Style 1', 'absolute-addons' ), 'style2' => esc_html__( 'Shape Style 2', 'absolute-addons' ), ), 'condition' => [ 'absolute_content_card' => 'fifteen', ], 'default' => 'style1', ) ); //Content card box tag section start $this->add_control( 'content_card_box_tag_title', [ 'label' => esc_html__( 'Tag Title', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Story', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'four', ], ] ); $this->add_control( 'content_card_box_tag_year', [ 'label' => esc_html__( 'Tag Year', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '2020', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'four', ], ] ); //Content card box tag section end //Content card box time duration section start $this->add_control( 'content_card_box_time_duration', [ 'label' => esc_html__( 'Time Duration', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '/ 5days 4night', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'three', ], ] ); //Content card box time duration section end //Content card box sale price section start $this->add_control( 'content_card_box_price_title', [ 'label' => esc_html__( 'Sale Price Title', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'PRICE:', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'five', ], ] ); $this->add_control( 'content_card_price_currency_symbol_thirteen', [ 'label' => esc_html__( 'Currency Symbol', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'USD', 'absolute-addons' ), 'condition' => [ 'absolute_content_card' => 'thirteen', ], ] ); $this->add_control( 'content_card_price_currency_symbol', [ 'label' => esc_html__( 'Currency Symbol', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '$', 'absolute-addons' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'four', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'thirteen', ], ], ], ] ); $this->add_control( 'content_card_box_regular_price', [ 'label' => esc_html__( 'Regular Price (Without Currency Symbol)', 'absolute-addons' ), 'type' => Controls_Manager::NUMBER, 'default' => esc_html__( '23.70', 'absolute-addons' ), 'step' => '0.01', 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'two', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'eight', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'fifteen', ], ], ], ] ); $this->add_control( 'content_card_box_sale_price', [ 'label' => esc_html__( 'Sale Price (Without Currency Symbol)', 'absolute-addons' ), 'type' => Controls_Manager::NUMBER, 'default' => esc_html__( '39.90', 'absolute-addons' ), 'step' => '0.01', 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'four', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seventeen', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'eighteen', ], ], ], ] ); //Content card box sale price section end $this->add_control( 'content_card_box_label', [ 'label' => esc_html__( 'Label', 'absolute-addons' ), 'label_block' => false, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'NEW', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'two', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'eight', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'eleven', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'fifteen', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'eighteen', ], ], ], ] ); $this->end_controls_section(); //Content card box button icon only section end //Content card box button start $this->start_controls_section( 'content_card_button_section', array( 'label' => esc_html__( 'Button', 'absolute-addons' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], ], ], ) ); $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' => 'no', 'separator' => 'before', ] ); $this->add_control( 'content_card_box_button', [ 'label' => esc_html__( 'Button Text', 'absolute-addons' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Button Text', 'absolute-addons' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], ], ], [ 'terms' => [ [ 'name' => 'enable_button', 'operator' => '==', 'value' => 'yes', ], ], ], ], ], ] ); $this->add_control( 'content_card_button_icon_only', [ 'label' => esc_html__( 'Button Icon', 'absolute-addons' ), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'fas fa-cart-arrow-down', 'library' => 'solid', ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'ten', ], ], ], 'condition' => [ 'enable_button' => 'yes', ], ] ); $this->add_control( 'content_card_box_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, ], 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], ], ], 'condition' => [ 'enable_button' => 'yes', ], ] ); //Content card box button icon start $this->add_control( 'content_card_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' => 'button-icon', 'separator' => 'before', 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], ], ], [ 'terms' => [ [ 'name' => 'enable_button', 'operator' => '==', 'value' => 'yes', ], ], ], ], ], ] ); $this->add_control( 'content_card_button_icon', [ 'label' => esc_html__( 'Button Icon', 'absolute-addons' ), 'type' => Controls_Manager::ICONS, 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], [ 'name' => 'content_card_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], [ 'terms' => [ [ 'name' => 'enable_button', 'operator' => '==', 'value' => 'yes', ], ], ], ], ], 'default' => [ 'value' => 'fas fa-angle-right', 'library' => 'solid', ], ] ); $this->add_control( 'content_card_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' => [ 'relation' => 'and', 'terms' => [ [ 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], [ 'name' => 'content_card_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], [ 'terms' => [ [ 'name' => 'enable_button', 'operator' => '==', 'value' => 'yes', ], ], ], ], ], 'default' => 'after', ) ); $this->add_responsive_control( 'content_card_button_icon_spacing', [ 'label' => esc_html__( 'Button Icon Spacing', 'absolute-addons' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'three', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'seven', ], [ 'name' => 'absolute_content_card', 'operator' => '!==', 'value' => 'ten', ], [ 'name' => 'content_card_button_icon_switch', 'operator' => '==', 'value' => 'button-icon', ], ], ], [ 'terms' => [ [ 'name' => 'enable_button', 'operator' => '==', 'value' => 'yes', ], ], ], ], ], 'selectors' => [ '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box-button-icon-after' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box-button-icon-before' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); //Content card box button icon end $this->end_controls_section(); //Content card box button end //Content card box rating section start $this->start_controls_section( 'section_rating', array( 'label' => esc_html__( 'Rating', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'four', ], [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'five', ], ], ], ) ); $this->add_control( 'content_card_rating', [ 'label' => esc_html__( 'Show Rating?', 'absolute-addons' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Yes', 'absolute-addons'), 'label_off' => __('No', 'absolute-addons'), 'return_value' => 'yes', 'default' => 'no', 'separator' => 'before', ] ); $this->add_control( 'rating_scale', [ 'label' => esc_html__( 'Rating Scale', 'absolute-addons' ), 'type' => Controls_Manager::SELECT, 'options' => [ '5' => '0-5', '10' => '0-10', ], 'default' => '5', 'condition' => [ 'content_card_rating' => 'yes', ], ] ); $this->add_control( 'rating', [ 'label' => esc_html__( 'Rating', 'absolute-addons' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 10, 'step' => 0.1, 'default' => 5, 'condition' => [ 'content_card_rating' => 'yes', ], ] ); $this->add_control( 'rating_count', [ 'label' => esc_html__( 'Rating Count', 'absolute-addons' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 1000, 'step' => 0.1, 'default' => 4.9, 'condition' => [ 'content_card_rating' => 'yes', ], ] ); $this->add_control( 'star_style', [ 'label' => esc_html__( 'Icon', 'absolute-addons' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'star_fontawesome' => 'Font Awesome', 'star_unicode' => 'Unicode', ], 'default' => 'star_fontawesome', 'render_type' => 'template', 'prefix_class' => 'elementor--star-style-', 'separator' => 'before', 'condition' => [ 'content_card_rating' => 'yes', ], ] ); $this->add_control( 'unmarked_star_style', [ 'label' => esc_html__( 'Unmarked Style', 'absolute-addons' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'solid' => [ 'title' => esc_html__( 'Solid', 'absolute-addons' ), 'icon' => 'eicon-star', ], 'outline' => [ 'title' => esc_html__( 'Outline', 'absolute-addons' ), 'icon' => 'eicon-star-o', ], ], 'default' => 'solid', 'condition' => [ 'content_card_rating' => 'yes', ], ] ); //Content card box rating section end $this->end_controls_section(); //Content card box separator start $this->start_controls_section( 'content_card_separator_section', array( 'label' => esc_html__( 'Separator', 'absolute-addons' ), 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'absolute_content_card', 'operator' => '==', 'value' => 'four', ], ], ], ) ); $this->add_control( 'content_card_separator', [ 'label' => esc_html__( 'Display Separator?', 'absolute-addons' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'content-card-show-separator', 'default' => 'content-card-show-separator', ] ); $this->add_control( 'content_card_separator_color', [ 'label' => esc_html__( 'Separator Color', 'absolute-addons' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'content_card_separator' => 'content-card-show-separator', ], 'selectors' => [ '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box .content-card-box-border::before' => 'background-color: {{VALUE}};', '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box .content-card-box-border::after' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'countdown_separator_width', [ 'label' => esc_html__( 'Separator Height', 'absolute-addons' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%', 'px' ], 'range' => [ 'px' => [ 'max' => 1000, ], ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'condition' => [ 'content_card_separator' => 'content-card-show-separator', ], 'selectors' => [ '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box .content-card-box-border::before' => 'height: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .absp-wrapper .absp-content-card-item .content-card-box .content-card-box-border::after' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); //Content card box separator End $this->render_controller( 'style-controller-content-card-settings' ); $this->render_controller( 'style-controller-content-card-title' ); $this->render_controller( 'style-controller-content-card-sub-title' ); $this->render_controller( 'style-controller-content-card-tag' ); $this->render_controller( 'style-controller-content-card-content' ); $this->render_controller( 'style-controller-content-card-currency' ); $this->render_controller( 'style-controller-content-card-images' ); $this->render_controller( 'style-controller-content-card-label' ); $this->render_controller( 'style-controller-content-card-one-sale-price' ); $this->render_controller( 'style-controller-content-card-rating' ); $this->render_controller( 'style-controller-content-card-regular-price' ); $this->render_controller( 'style-controller-content-card-sale-price' ); $this->render_controller( 'style-controller-content-card-three-time-duration' ); $this->render_controller( 'style-controller-content-card-shape' ); $this->render_controller( 'style-controller-content-card-button' ); /** * Fires after controllers are registered. * * @param Absoluteaddons_Style_Content_Card $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 ] ); } /** * @since 1.1.0 * @access protected */ protected function get_rating() { $settings = $this->get_settings_for_display(); $rating_scale = (int) $settings['rating_scale']; $rating = (float) $settings['rating'] > $rating_scale ? $rating_scale : $settings['rating']; return [ $rating, $rating_scale ]; } /** * Print the actual stars and calculate their filling. * * Rating type is float to allow stars-count to be a fraction. * Floored-rating type is int, to represent the rounded-down stars count. * In the `for` loop, the index type is float to allow comparing with the rating value. * * @since 1.1.0 * @access protected */ protected function render_stars( $icon ) { $rating_data = $this->get_rating(); $rating = (float) $rating_data[0]; $floored_rating = floor( $rating ); $stars_html = ''; for ( $stars = 1.0; $stars <= $rating_data[1]; $stars++ ) { if ( $stars <= $floored_rating ) { $stars_html .= '' . $icon . ''; } elseif ( $floored_rating + 1 === $stars && $rating !== $floored_rating ) { $stars_html .= '' . $icon . ''; } else { $stars_html .= '' . $icon . ''; } } return $stars_html; } /** * 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(); $rating_data = $this->get_rating(); $textual_rating = $rating_data[0] . '/' . $rating_data[1]; $icon = ''; if ( 'star_fontawesome' === $settings['star_style'] ) { if ( 'outline' === $settings['unmarked_star_style'] ) { $icon = ''; } } elseif ( 'star_unicode' === $settings['star_style'] ) { $icon = '★'; if ( 'outline' === $settings['unmarked_star_style'] ) { $icon = '☆'; } } $this->add_render_attribute( 'icon_wrapper', [ 'class' => 'elementor-star-rating', 'title' => $textual_rating, 'itemtype' => 'https://schema.org/Rating', 'itemscope' => '', 'itemprop' => 'reviewRating', ] ); $schema_rating = '' . $textual_rating . ''; $stars_element = '
get_render_attribute_string( 'icon_wrapper' ) . '>' . $this->render_stars( $icon ) . ' ' . $schema_rating . '
'; $this->add_inline_editing_attributes( 'content_card_box_title' ); $this->add_render_attribute( 'content_card_box_title', 'class', 'content-card-box-title' ); //Content card box sub title inline attribut start $this->add_inline_editing_attributes( 'content_card_box_sub_title' ); $this->add_render_attribute( 'content_card_box_sub_title', 'class', 'content-card-box-sub-title' ); $this->add_inline_editing_attributes( 'content_card_box_sub_title_two' ); $this->add_render_attribute( 'content_card_box_sub_title_two', 'class', 'content-card-box-sub-title' ); $this->add_inline_editing_attributes( 'content_card_box_sub_title_fifteen' ); $this->add_render_attribute( 'content_card_box_sub_title_fifteen', 'class', 'content-card-box-sub-title' ); //Content card box time duration start $this->add_inline_editing_attributes( 'content_card_box_time_duration' ); $this->add_render_attribute( 'content_card_box_time_duration', 'class', 'content-card-box-delivery-time' ); //Content card box regular price inline attribut start $this->add_inline_editing_attributes( 'content_card_box_regular_price_two' ); $this->add_render_attribute( 'content_card_box_regular_price_two', 'class', 'content-card-box-regular-price' ); //Content card box sale price inline attribut start $this->add_inline_editing_attributes( 'content_card_box_sale_price_one' ); $this->add_render_attribute( 'content_card_box_sale_price_one', 'class', 'content-card-box-sale-price' ); $this->add_inline_editing_attributes( 'content_card_box_sale_price_two' ); $this->add_render_attribute( 'content_card_box_sale_price_two', 'class', 'content-card-box-sale-price' ); //Content card box label inline attribut start $this->add_inline_editing_attributes( 'content_card_box_label' ); $this->add_render_attribute( 'content_card_box_label', 'class', 'content-card-box-label' ); //Content card box button inline attribut start $this->add_inline_editing_attributes( 'content_card_box_button' ); if ( ! empty( $settings['content_card_box_button_url']['url'] ) ) { $this->add_link_attributes( 'content_card_box_button', $settings['content_card_box_button_url'] ); } $regular_price = ! empty( $settings['content_card_box_regular_price'] ) ? $settings['content_card_box_regular_price'] : 0; $regular_price_array = absp_regular_pricing_price_format( $regular_price ); $price = ! empty( $settings['content_card_box_sale_price'] ) ? $settings['content_card_box_sale_price'] : 0; $price_array = absp_pricing_price_format( $price ); ?>
render_template( $settings['absolute_content_card'], [ 'hover_animation' => $hover_animation, 'cart_image_class' => $cart_image_class, 'price' => $price, 'price_array' => $price_array, 'regular_price' => $regular_price, 'regular_price_array' => $regular_price_array, 'stars_element' => $stars_element, ] ); ?>
print_render_attribute_string( 'content_card_box_label' ); ?>>

print_render_attribute_string( 'content_card_box_title' ); ?> >

'; echo wp_get_attachment_image( $settings['content_card_button_icon']['value']['id'] ); echo ''; } else { ?> Placeholder Image
add_render_attribute( 'content_card_box_button', 'class', $class ); ?> print_render_attribute_string( 'content_card_box_button' ); ?> > '; echo wp_get_attachment_image( $settings['content_card_button_icon_only']['value']['id'] ); echo ''; } else { ?> Placeholder Image
render_card_button_icon( $settings ); ?>
render_card_button_icon( $settings ); ?>