start_controls_section( 'content_section', array( 'label' => esc_html__( 'Ustawienia Kalendarza', 'yacht-booking' ), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'calendar_height', array( 'label' => esc_html__( 'Wysokość kalendarza', 'yacht-booking' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 400, 'max' => 1000, ), ), 'default' => array( 'size' => 650, 'unit' => 'px', ), ) ); $this->add_control( 'show_legend', array( 'label' => esc_html__( 'Pokaż legendę kolorów', 'yacht-booking' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Tak', 'yacht-booking' ), 'label_off' => esc_html__( 'Nie', 'yacht-booking' ), 'return_value' => 'yes', 'default' => 'yes', ) ); $this->end_controls_section(); } /** * Render widget output. */ protected function render() { $settings = $this->get_settings_for_display(); $height = ! empty( $settings['calendar_height']['size'] ) ? (int) $settings['calendar_height']['size'] : 650; $show_legend = ! isset( $settings['show_legend'] ) || 'yes' === $settings['show_legend']; $dom_id = 'yacht-calendar-all-' . $this->get_id(); echo Calendar_All_View::render( $dom_id, $height, $show_legend ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } /** * Pomocnicza klasa renderująca markup widgetu i shortcode. * * Wspólna dla widgetu Elementor i shortcode `[yacht_calendar_all]` żeby uniknąć duplikacji. */ class Calendar_All_View { /** * Render markup wspólnego kalendarza. * * @param string $dom_id Unikalny ID kontenera FullCalendar. * @param int $height Wysokość kalendarza w px. * @param bool $show_legend Czy renderować legendę. * @return string HTML. */ public static function render( $dom_id, $height = 650, $show_legend = true ) { $rest_url = esc_url_raw( rest_url( 'yacht-booking/v1/availability/all' ) ); // Yachts for legend + form select. $yacht_posts = get_posts( array( 'post_type' => 'yacht', 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'ID', 'order' => 'ASC', ) ); $yacht_ids = wp_list_pluck( $yacht_posts, 'ID' ); $color_map = \YachtBooking\Rest_Controller::get_yacht_color_palette( $yacht_ids ); $global_color = \YachtBooking\Rest_Controller::GLOBAL_EVENT_COLOR; $sync_mode = \YachtBooking\Settings::get_ical_sync_mode(); $terms_url = \YachtBooking\Settings::get_terms_page_url(); $form_uid = preg_replace( '/[^a-z0-9_-]/i', '', $dom_id ); ob_start(); ?>

ID ] ) ? $color_map[ $yacht->ID ] : $global_color; ?> post_title ); ?>

' . esc_html__( 'regulamin', 'yacht-booking' ) . '' ); ?>