This commit is contained in:
2026-05-07 14:57:59 +02:00
parent c4a485e530
commit 811069a25c
35 changed files with 2980 additions and 30 deletions

View File

@@ -41,6 +41,39 @@ class Shortcode {
*/
private function __construct() {
add_shortcode( 'yacht_calendar', array( $this, 'render_calendar' ) );
add_shortcode( 'yacht_calendar_all', array( $this, 'render_calendar_all' ) );
}
/**
* Render shortcode `[yacht_calendar_all]` — wspólny kalendarz wszystkich jachtów.
*
* Atrybuty:
* - height: wysokość w px (default 650)
* - show_legend: yes|no (default yes)
*
* @param array $atts Shortcode attributes.
* @return string HTML.
*/
public function render_calendar_all( $atts ) {
$atts = shortcode_atts(
array(
'height' => 650,
'show_legend' => 'yes',
),
$atts,
'yacht_calendar_all'
);
// Lazy-load widget class for the View helper.
if ( ! class_exists( '\YachtBooking\Calendar_All_View' ) ) {
require_once YACHT_BOOKING_PLUGIN_DIR . 'frontend/class-calendar-widget-all.php';
}
$dom_id = 'yacht-calendar-all-' . wp_rand( 1000, 9999 );
$height = (int) $atts['height'];
$show_legend = 'yes' === strtolower( (string) $atts['show_legend'] );
return Calendar_All_View::render( $dom_id, $height, $show_legend );
}
/**