Bitrix API

Option

Table of Contents

Methods

delete()  : mixed
Deletes options from a DB.
get()  : string
Returns a value of an option.
getDefaults()  : array<string|int, mixed>
Returns an array with default values of a module options (from a default_option.php file).
getForModule()  : array<string|int, mixed>
Returns an array of set options array(name => value).
getRealValue()  : null|string
Returns the real value of an option as it's written in a DB.
set()  : mixed
Sets an option value and saves it into a DB. After saving the OnAfterSetOption event is triggered.

Methods

delete()

Deletes options from a DB.

public static delete(string $moduleId[, array<string|int, mixed> $filter = array() ]) : mixed
Parameters
$moduleId : string

The module ID.

$filter : array<string|int, mixed> = array()

{name: string, site_id: string} The array with filter keys: name - the name of the option; site_id - the site ID (can be empty).

Tags
throws
ArgumentNullException
throws
ArgumentException

get()

Returns a value of an option.

public static get(string $moduleId, string $name[, string $default = "" ][, bool|string $siteId = false ]) : string
Parameters
$moduleId : string

The module ID.

$name : string

The option name.

$default : string = ""

The default value to return, if a value doesn't exist.

$siteId : bool|string = false

The site ID, if the option differs for sites.

Return values
string

getDefaults()

Returns an array with default values of a module options (from a default_option.php file).

public static getDefaults(string $moduleId) : array<string|int, mixed>
Parameters
$moduleId : string

The module ID.

Tags
throws
ArgumentOutOfRangeException
Return values
array<string|int, mixed>

getForModule()

Returns an array of set options array(name => value).

public static getForModule(string $moduleId[, bool|string $siteId = false ]) : array<string|int, mixed>
Parameters
$moduleId : string

The module ID.

$siteId : bool|string = false

The site ID, if the option differs for sites.

Tags
throws
ArgumentNullException
Return values
array<string|int, mixed>

getRealValue()

Returns the real value of an option as it's written in a DB.

public static getRealValue(string $moduleId, string $name[, bool|string $siteId = false ]) : null|string
Parameters
$moduleId : string

The module ID.

$name : string

The option name.

$siteId : bool|string = false

The site ID.

Tags
throws
ArgumentNullException
Return values
null|string

set()

Sets an option value and saves it into a DB. After saving the OnAfterSetOption event is triggered.

public static set(string $moduleId, string $name[, string $value = "" ][, string $siteId = "" ]) : mixed
Parameters
$moduleId : string

The module ID.

$name : string

The option name.

$value : string = ""

The option value.

$siteId : string = ""

The site ID, if the option depends on a site.

Tags
throws
ArgumentOutOfRangeException

        
On this page

Search results