PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.4.2
LatePoint – Calendar Booking Plugin for Appointments and Events v5.4.2
5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / misc / step.php
latepoint / lib / misc Last commit date
blocked_period.php 3 months ago booked_period.php 3 months ago booking_request.php 3 months ago booking_resource.php 3 months ago booking_slot.php 3 months ago filter.php 3 months ago process_action.php 3 months ago process_event.php 3 months ago role.php 3 months ago router.php 3 months ago step.php 3 months ago stripe_connect_customer.php 3 months ago time_period.php 3 months ago user.php 3 months ago work_period.php 3 months ago
step.php
73 lines
1 <?php
2 /*
3 * Copyright (c) 2024 LatePoint LLC. All rights reserved.
4 */
5
6 namespace LatePoint\Misc;
7
8 class Step {
9 public string $code;
10 public string $label;
11 public string $side_panel_heading;
12 public string $side_panel_description;
13 public string $main_panel_heading;
14 public string $main_panel_content_before;
15 public string $main_panel_content_after;
16 public string $side_panel_custom_image_id;
17
18
19 function __construct( $args = [] ) {
20 $allowed_props = static::allowed_props();
21 foreach ( $args as $key => $arg ) {
22 if ( in_array( $key, $allowed_props ) ) {
23 $this->$key = $arg;
24 }
25 }
26 }
27
28 public function get_image_url_for_side_panel(): string {
29 if ( $this->is_using_custom_image_for_side_panel() ) {
30 return \OsImageHelper::get_image_url_by_id( $this->side_panel_custom_image_id, 'thumbnail', '' );
31 } else {
32 return '';
33 }
34 }
35
36 public function get_default_image_html_for_side_panel() {
37 return \OsStepsHelper::get_default_side_panel_image_html_for_step_code( $this->code );
38 }
39
40
41 public function is_using_custom_image_for_side_panel(): bool {
42 return ! empty( $this->side_panel_custom_image_id );
43 }
44
45 public static function create_from_settings( string $step_code, array $step_settings ): Step {
46 return new Step(
47 [
48 'code' => $step_code,
49 'label' => \OsStepsHelper::get_step_label_by_code( $step_code ),
50 'side_panel_heading' => $step_settings['side_panel_heading'] ?? '',
51 'side_panel_description' => $step_settings['side_panel_description'] ?? '',
52 'main_panel_heading' => $step_settings['main_panel_heading'] ?? '',
53 'main_panel_content_before' => $step_settings['main_panel_content_before'] ?? '',
54 'main_panel_content_after' => $step_settings['main_panel_content_after'] ?? '',
55 'side_panel_custom_image_id' => $step_settings['side_panel_custom_image_id'] ?? '',
56 ]
57 );
58 }
59
60 public static function allowed_props(): array {
61 return [
62 'code',
63 'label',
64 'side_panel_heading',
65 'side_panel_description',
66 'main_panel_heading',
67 'main_panel_content_before',
68 'main_panel_content_after',
69 'side_panel_custom_image_id',
70 ];
71 }
72 }
73