update
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user