bricks_widget_book_button.php
1 year ago
bricks_widget_book_form.php
1 year ago
bricks_widget_calendar.php
1 year ago
bricks_widget_customer_dashboard.php
1 year ago
bricks_widget_customer_login.php
1 year ago
bricks_widget_list_of_resources.php
1 year ago
bricks_widget_calendar.php
92 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class Latepoint_Bricks_Widget_Calendar extends \Bricks\Element { |
| 8 | |
| 9 | public $category = 'latepoint'; |
| 10 | public $name = 'latepoint_calendar'; |
| 11 | public $icon = 'ti-calendar'; |
| 12 | |
| 13 | |
| 14 | public function get_label(): string { |
| 15 | return esc_html__( 'Latepoint Calendar', 'latepoint' ); |
| 16 | } |
| 17 | |
| 18 | public function set_controls() { |
| 19 | $this->controls['_width']['default'] = '100%'; |
| 20 | |
| 21 | $this->controls['date'] = [ |
| 22 | 'tab' => 'content', |
| 23 | 'label' => esc_html__( 'Date', 'latepoint' ), |
| 24 | 'type' => 'datepicker', |
| 25 | 'inline' => true, |
| 26 | 'options' => [ |
| 27 | 'enableTime' => false, |
| 28 | 'time_24hr' => true |
| 29 | ] |
| 30 | ]; |
| 31 | |
| 32 | $this->controls['show_agents'] = [ |
| 33 | 'tab' => 'content', |
| 34 | 'label' => esc_html__( 'Show Agents', 'latepoint' ), |
| 35 | 'type' => 'select', |
| 36 | 'options' => OsBricksHelper::get_data('agents'), |
| 37 | 'placeholder' => esc_html__( 'Select Agents', 'latepoint' ), |
| 38 | 'multiple' => true, |
| 39 | 'searchable' => true, |
| 40 | 'clearable' => true, |
| 41 | ]; |
| 42 | |
| 43 | $this->controls['show_services'] = [ |
| 44 | 'tab' => 'content', |
| 45 | 'label' => esc_html__( 'Show Services', 'latepoint' ), |
| 46 | 'type' => 'select', |
| 47 | 'options' => OsBricksHelper::get_data('services'), |
| 48 | 'placeholder' => esc_html__( 'Select Services', 'latepoint' ), |
| 49 | 'multiple' => true, |
| 50 | 'searchable' => true, |
| 51 | 'clearable' => true, |
| 52 | ]; |
| 53 | |
| 54 | $this->controls['show_locations'] = [ |
| 55 | 'tab' => 'content', |
| 56 | 'label' => esc_html__( 'Show Locations', 'latepoint' ), |
| 57 | 'type' => 'select', |
| 58 | 'options' => OsBricksHelper::get_data('locations'), |
| 59 | 'placeholder' => esc_html__( 'Select Locations', 'latepoint' ), |
| 60 | 'multiple' => true, |
| 61 | 'searchable' => true, |
| 62 | 'clearable' => true, |
| 63 | ]; |
| 64 | |
| 65 | $this->controls['view'] = [ |
| 66 | 'tab' => 'content', |
| 67 | 'label' => esc_html__( 'View', 'latepoint' ), |
| 68 | 'type' => 'select', |
| 69 | 'options' => [ |
| 70 | 'month' => esc_html__( 'Month', 'latepoint' ), |
| 71 | 'week' => esc_html__( 'Week', 'latepoint' ), |
| 72 | ], |
| 73 | 'placeholder' => esc_html__( 'Month', 'latepoint' ), |
| 74 | 'default' => 'month', |
| 75 | ]; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | // Render element HTML |
| 80 | public function render() { |
| 81 | $allowed_params = [ |
| 82 | 'date', |
| 83 | 'show_services', |
| 84 | 'show_agents', |
| 85 | 'show_locations', |
| 86 | 'view' |
| 87 | ]; |
| 88 | |
| 89 | $params = OsBlockHelper::attributes_to_data_params($this->settings, $allowed_params); |
| 90 | echo do_shortcode('[latepoint_calendar ' . $params . ']'); |
| 91 | } |
| 92 | } |