miniCal
  • Quick Start
    • Introduction
  • miniCal Configuration
    • miniCal Hosted Service
    • Configure Feature Settings
    • Install Extensions
    • Create Multiple Properties
  • Local Installation
    • Local Installation
    • ENV Set-Up
    • Configuration Settings
    • Common Installations Errors
  • Contribution
    • Contribute to miniCal Core
  • Build an Extension
    • Build Your First Extension
      • Controllers
      • Assets
      • Config
      • language
      • Models
      • View
      • Helper
      • Library
      • Hooks
    • Open-source Extensions
    • Config Folder Files
      • Autoload File
      • Config File
      • Route File
    • miniCal Filters
    • miniCal Actions
    • Create Custom Hooks
    • Store Custom Data
      • POSTS
      • POSTMETA
      • OPTIONS
    • Composer Dependencies
  • Marketplace
    • miniCal Marketplace
  • Other resources
    • Overbooking for OTAs
    • miniCal Cron Setup
    • Automated Night Audit
    • Nginx Configuration
    • Docker Installation
    • Custom Domain Setup
  • Minical API Docs
    • API Documentation
  • Coming soon!
    • Access minical Data Using Helpers
      • Company Helper Functions
      • Customer Helper Functions
      • Booking Helper Functions
      • Rates Helper Functions
      • Rate Plan Helper Functions
      • Availability Helper Functions
      • Statement Helper Functions
      • Tax Helper Functions
      • Room Helper Functions
      • Charge Helper Functions
      • Payment Helper Functions
    • Access data in Extension
Powered by GitBook
On this page
  • Options
  • Structure of the miniCal options Table
  • Using the Options
  1. Build an Extension
  2. Store Custom Data

OPTIONS

Options

Options are the way to store extension-related settings that have an impact on a company. All the data is stored in the options table and mapped with the company_id. Here is the columns options table has.

Structure of the miniCal options Table

The options table has a similar structure to the metadata tables. It has five fields:

  • option_ID

  • company_id- Current company id.

  • option_name- Name of an option (key).

  • option_value- Value of option (value).

  • autoload - Whether to load the option when extension starts up. Default is enabled. The boolean value true/false.

Each record in the option_name field will be a unique value: if you add more than one value to an option, miniCal stores this in an array in the option_value field.

// Add a new option.
add_option(string $option, $value = '', bool $autoload = true)

// Removes option by name.
delete_option( string $option )

// Retrieves an option value based on an option name.
get_option( string $option, bool $default = false)

// Update the value of an option that was already added.
update_option( string $option, $value = '', bool $autoload = true )

Using the Options

The Options consists of four functions that allow you to add, get, update or delete options:

Method
Description
Parameters Description
Return value

add_option()

Adds a new option value.

add_option(string $option, $value = '', bool $autoload = true) 1. string $option (Required) Name of the option to add. 2. mixed $value (Optional) Option value. 3. bool $autoload (Optional) Whether to load the option when extension starts up. Default is enabled.

bool True if the option was added, null otherwise.

get_option()

Get option value.

get_option( string $option, bool $default = false) 1. string $option (Required) Name of the option to add. 2. bool $default (Optional) Default value to return if the option does not exist.

bool Value of the option. A value of any type may be returned, If there is no option in the database, boolean false is returned

update_option()

Update option value.

update_option( string $option, $value = '', bool $autoload = true ) 1. string $option (Required) Name of the option to update. 2. mixed $value (Required) Option value. 3. bool $autoload (Optional) Whether to load the option when extension starts up. Default is enabled.

bool True if the value was updated, false otherwise.

delete_option()

delete option value.

delete_option( string $option ) 1. string $option (Required) Name of the option to delete.

bool True if the option was deleted, false otherwise.

PreviousPOSTMETANextComposer Dependencies

Last updated 3 years ago