OptionsManager Class
The OptionsManager class is used to manage application or user options in Bitrix24. It extends the functionality of AbstractHelper and provides methods for retrieving, encoding, and saving options.
Getters
data
get data(): Map<string, any>Returns a Map of option data.
Methods
getSupportTypes
static getSupportTypes(): TypeOption[]Returns an array of supported option types TypeOption.
prepareArrayList
static prepareArrayList(list: any): any[]Converts input data into an array, if possible.
reset
reset(): voidResets the option data.
getJsonArray
getJsonArray(
key: string,
defValue: any[] = []
): any[]Returns the option value as an array.
getJsonObject
getJsonObject(
key: string,
defValue: Object = {}
): ObjectReturns the option value as an object.
getFloat
getFloat(
key: string,
defValue: number = 0.0
): numberReturns the option value as a floating-point number.
getInteger
getInteger(
key: string,
defValue: number = 0
): numberReturns the option value as an integer.
getBoolYN
getBoolYN(
key: string,
defValue: boolean = true
): booleanReturns the option value as a boolean (yes/no).
getBoolNY
getBoolNY(
key: string,
defValue: boolean = false
): booleanReturns the option value as a boolean (no/yes).
getString
getString(
key: string,
defValue: string = ''
): stringReturns the option value as a string.
getDate
getDate(
key: string,
defValue: null|DateTime = null
): null|DateTimeReturns the option value as a DateTime object.
encode
encode(
value: any
): stringEncodes a value into a JSON string.
decode
decode(
data: string,
defaultValue: any
): anyDecodes a JSON string into an object.
save
async save(
options: any,
optionsPull?: {
moduleId: string,
command: string,
params: any
}
): Promise<Result>Saves options and sends an event through Pull.
Data Types
TypeOption
The TypeOption enumeration defines option types.
NotSet: Not set.JsonArray: JSON array.JsonObject: JSON object.FloatVal: Floating-point number.IntegerVal: Integer.BoolYN: Boolean value (yes/no).StringVal: String.