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(): void
Resets the option data.
getJsonArray
getJsonArray(
key: string,
defValue: any[] = []
): any[]
Returns the option value as an array.
getJsonObject
getJsonObject(
key: string,
defValue: Object = {}
): Object
Returns the option value as an object.
getFloat
getFloat(
key: string,
defValue: number = 0.0
): number
Returns the option value as a floating-point number.
getInteger
getInteger(
key: string,
defValue: number = 0
): number
Returns the option value as an integer.
getBoolYN
getBoolYN(
key: string,
defValue: boolean = true
): boolean
Returns the option value as a boolean (yes/no).
getBoolNY
getBoolNY(
key: string,
defValue: boolean = false
): boolean
Returns the option value as a boolean (no/yes).
getString
getString(
key: string,
defValue: string = ''
): string
Returns the option value as a string.
getDate
getDate(
key: string,
defValue: null|DateTime = null
): null|DateTime
Returns the option value as a DateTime
object.
encode
encode(
value: any
): string
Encodes a value into a JSON string.
decode
decode(
data: string,
defaultValue: any
): any
Decodes 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.