# booktics/1.0.29/core/onboard/onboarding.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.29. 84 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.29/code/core/onboard/onboarding.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.29/raw/core/onboard/onboarding.php
- Modified: 2025-07-10T04:07:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booktics/1.0.29/code/core/onboard/onboarding.php#L10-L20`.

```php
<?php
/**
 * Manage onboarding
 *
 * @package Booktics/Onboard
 */

namespace Booktics\Onboard;

use Booktics\Services\Schedule_Manager;
use Booktics\Settings\Settings;
use WP_Error;

/**
 * Class Onboarding
 */
class Onboarding {
    /**
     * Store onboarding fields
     *
     * @var []
     */
    protected static $fields = array(
        'business_email'    => '',
        'business_name'     => '',
        'business_type'     => '',
        'business_timezone' => '',
        'schedule'          => '',
        'custom'            => '',
        'holiday'           => '',
        'onboard_setup'     => '',
    );

    /**
     * Setup onboarding profile
     *
     * @param array $data Onboarding data
     *
     * @return  bool | WP_Error
     */
    public static function update( $data = array() ) {
        if ( $data ) {
            foreach ( $data as $key => $value ) {
                if ( ! array_key_exists( $key, self::$fields ) ) {
                    return new WP_Error(
                        'invalid_field',
                        // translators: %s is the name of the invalid field.
                        sprintf( __( 'Invalid field %s', 'booktics' ), $key ),
                        array( 'status' => 422 )
                    );
                }
            }
        }

        if ( isset( $data['schedule'] ) || isset( $data['custom'] ) || isset( $data['holiday'] ) ) {
            $schedule_manager = Schedule_Manager::make( $data );
            $schedule_manager->save();
            unset( $data['schedule'], $data['custom'], $data['holiday'] );
        }

        return Settings::update( $data );
    }

    /**
     * Get onboard field
     *
     * @param string $key Onboarding field
     *
     * @return  mixed
     */
    public static function get( $key ) {
        if ( ! array_key_exists( $key, self::$fields ) ) {
            return new WP_Error(
                'invalid_field',
                // translators: %s is the name of the invalid field.
                sprintf( __( 'Invalid field %s', 'booktics' ), $key ),
                array( 'status' => 422 )
            );
        }

        return Settings::get( $key );
    }
}

```
