wpcap_content_layout_options(); $this->wpcap_box_layout_options(); $this->wpcap_design_options(); $this->wpcap_filter_options(); } /** * Content Layout Options. */ private function wpcap_content_layout_options() { $this->start_controls_section( 'section_layout', [ 'label' => esc_html__('Layout', 'fieldday'), ] ); $this->add_control( 'session_layout', [ 'label' => __('View', 'fieldday'), 'type' => Controls_Manager::SELECT, 'options' => [ '1' => __('1 Column view', 'fieldday'), '2' => __('2 Columns view', 'fieldday'), '3' => __('3 Colums view', 'fieldday'), '4' => __('4 Columns view', 'fieldday'), '5' => __('5 Columns view', 'fieldday'), '6' => __('6 Columns view', 'fieldday'), ], 'default' => '3', ] ); $this->add_control( 'show_image', [ 'label' => __('Image', 'fieldday'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Show', 'fieldday'), 'label_off' => __('Hide', 'fieldday'), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'show_title', [ 'label' => __('Title', 'fieldday'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Show', 'fieldday'), 'label_off' => __('Hide', 'fieldday'), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'title_tag', [ 'label' => __('Title HTML Tag', 'fieldday'), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h3', 'condition' => [ 'show_title' => 'yes', ], ] ); $this->add_control( 'show_learn_more', [ 'label' => __('Learn More', 'fieldday'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Show', 'fieldday'), 'label_off' => __('Hide', 'fieldday'), 'default' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'read_more_text', [ 'label' => __('More Information Text', 'fieldday'), 'type' => Controls_Manager::TEXT, 'default' => __('Learn More', 'fieldday'), 'condition' => [ 'show_learn_more' => 'yes', ], ] ); $this->add_control( 'purchase_text', [ 'label' => __('Purchase Button Text', 'fieldday'), 'type' => Controls_Manager::TEXT, 'default' => __('Purchase', 'fieldday'), ] ); $this->end_controls_section(); } /** * layout controls */ private function wpcap_box_layout_options() { $this->start_controls_section( 'section_box_options', [ 'label' => __('Box Options', 'fieldday'), ] ); $this->add_control( 'entrance_animation', [ 'label' => __('Entrance Animation', 'fieldday'), 'type' => \Elementor\Controls_Manager::ANIMATION, 'prefix_class' => 'animated ', ] ); $this->add_control( 'box_image_effect', [ 'label' => esc_html__('Hover Effect', 'fieldday'), 'type' => Controls_Manager::SELECT, 'options' => [ 'km_zoom-in' => esc_html__('Zoom In', 'fieldday'), 'km_zoom-out' => esc_html__('Zoom Out', 'fieldday'), 'km_blur' => esc_html__('Blur', 'fieldday'), 'km_slide' => esc_html__('Slide', 'fieldday'), 'km_rotate' => esc_html__('Rotate', 'fieldday'), 'km_flashing' => esc_html__('Flashing', 'fieldday'), 'km_shine' => esc_html__('Shine', 'fieldday'), 'km_circle' => esc_html__('Circle', 'fieldday'), ], 'default' => 'km_blur', ] ); $this->add_control( 'box_background', [ 'label' => __('Box Default Image', 'fieldday'), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], ] ); $this->add_control( 'box_color', [ 'label' => __('Box Background', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_single' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'box_overlay_color', [ 'label' => __('Box Overlay', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_single .km_featured_session_img::after' => 'background: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'border', 'label' => __('Border', 'plugin-domain'), 'selector' => '{{WRAPPER}} .km_featured_single', 'fields_options' => [ 'border' => [ 'default' => 'solid', ], 'width' => [ 'default' => [ 'top' => '1', 'right' => '1', 'bottom' => '1', 'left' => '1', 'isLinked' => true, ], ], 'color' => [ 'default' => '#ccc', ], ], ] ); $this->add_control( 'box-radious', [ 'label' => __('Border Radius', 'post-grid-elementor-addon'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .km_featured_single' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'default' => [ 'top' => 15, 'left' => 15, 'bottom' => 15, 'right' => 15, 'unit' => 'px', 'isLinked' => true, ], ] ); $this->add_control( 'box-padding', [ 'label' => __('Box Padding', 'post-grid-elementor-addon'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .km_featured_single .km_featured_session_content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', 'label' => __('Box Shadow', 'plugin-domain'), 'selector' => '{{WRAPPER}} .km_featured_single', ] ); $this->end_controls_section(); } /** * design controls */ private function wpcap_design_options() { $this->start_controls_section( 'section_design_options', [ 'label' => __('Design Options', 'elementor'), ] ); $this->add_control( 'title_color', [ 'label' => __('Title Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_session_title' => 'color: {{VALUE}}!important;', ], ] ); $this->add_control( 'address_color', [ 'label' => __('Address Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_session_location a' => 'color: {{VALUE}}!important;', ], ] ); $this->add_control( 'age_color', [ 'label' => __('Age Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_age' => 'color: {{VALUE}}!important;', ], ] ); $this->add_control( 'seats_color', [ 'label' => __('Seats Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_availspots ' => 'color: {{VALUE}}!important;', ], ] ); $this->add_control( 'price_color', [ 'label' => __('Price Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_session_price' => 'color: {{VALUE}}!important;', ], ] ); $this->add_control( 'date_color', [ 'label' => __('Date Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_date' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'time_color', [ 'label' => __('Time Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_time' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'learn_more_back_color', [ 'label' => __('Learn More Button Background', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_learn_more_btn' => 'background-color: {{VALUE}} !important;', ], ] ); $this->add_control( 'learn_more_color', [ 'label' => __('Learn More Button Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_learn_more_btn' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'purchase_back_color', [ 'label' => __('Purchase Button Background', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_btns .km_feature_purchase_btn' => 'background-color: {{VALUE}}!important;', ], ] ); $this->add_control( 'purchase_color', [ 'label' => __('Purchase Button Color', 'elementor'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .km_featured_btns .km_feature_purchase_btn' => 'color: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * filter controls */ private function wpcap_filter_options() { $this->start_controls_section( 'section_filter_options', [ 'label' => __('Filter Options', 'elementor'), ] ); $this->add_control( 'session_group_by', [ 'label' => __('Group Sessions By Activity', 'fieldday'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Yes', 'fieldday'), 'label_off' => __('No', 'fieldday'), 'default' => 'no', 'separator' => 'before', ] ); $this->add_control( 'session_filters', [ 'label' => __('Enable Filters', 'fieldday'), 'type' => Controls_Manager::SWITCHER, 'label_on' => __('Yes', 'fieldday'), 'label_off' => __('No', 'fieldday'), 'default' => 'no', 'separator' => 'before', ] ); $this->add_control( 'session_tag_id', [ 'label' => esc_html__('Session Type', 'fieldday'), 'type' => Controls_Manager::SELECT, 'options' => self::activityTags(), 'default' => 'all', 'condition' => [ 'session_filters' => 'yes', ], ] ); $this->add_control( 'session_activity_id', [ 'label' => esc_html__('Activity', 'fieldday'), 'type' => Controls_Manager::SELECT, 'options' => self::activitiesList(), 'default' => 'all', 'condition' => [ 'session_filters' => 'yes', ], ] ); $this->add_control( 'session_age_from', [ 'label' => esc_html__('Age From', 'fieldday'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 1, 'max' => 30, 'step' => 1, 'default' => 1, 'condition' => [ 'session_filters' => 'yes', ], ] ); $this->add_control( 'session_age_to', [ 'label' => esc_html__('Age To', 'fieldday'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 5, 'max' => 99, 'default' => 10, 'step' => 1, 'condition' => [ 'session_filters' => 'yes', ], ] ); } /** * get the list of activities * @return array list of activities */ private function activitiesList() { $activityOptions = ['all' => 'all']; $activities = fieldday()->api->homeSessionActivities(); foreach ($activities->data as $key => $activity) { $activityOptions[$activity->_id] = $activity->title; } return $activityOptions; } /** * get the list of activity tags * @return array list of activity tags */ private function activityTags() { $tagsOptions = ['all' => 'all']; $activityTags = fieldday()->api->getActivityTagsCount(); foreach ($activityTags->data as $key => $tags) { $tagsOptions[$tags->_id] = $tags->title; } return $tagsOptions; } /** * normalize sessions * @param mixed $sessions */ protected function normalizedSessions($sessions) { if ($this->settings['session_group_by'] == 'yes') { $grouppedsessions = []; foreach ($sessions as $key => $session) { $grouppedsessions[$session->activityId->title][] = $session; } return $grouppedsessions; } return $sessions; } private function displaySessionList($featuredSession) { $sessions = $this->normalizedSessions($featuredSession->data->sessions); print '