Documentation

GetOptionString

string
COption::GetOptionString(
 string module_id,
 string name,
 mixed def = false,
 string site = false,
 bool ExactSite=false
)

The method returns the option_id parameter value, belonging to the module_id. If the site_id parameter is not specified, an attempt is made to find the option_id parameter, belonging to the module_id for the current site. If such parameter does not exist, a parameter general for all sites is returned. Static method.

Parameters

ParameterDescription Available from version
module_id Module ID.
name Parameter ID.
def Default value.
If default_value is not specified, it will be taken from the array with name ${module_id."_default_option"} specified in the file /bitrix/modules/module_id/default_option.php.
site Site ID for which the parameters will be returned. Optional parameter. False by default (for the current site, and if not specified - general for all sites)
ExactSite Optional parameter. False by default.

See Also

Examples of use

<?
// get the field "Add to group upon registration" 
// from the Kernel module settings
$default_group = COption::GetOptionString("main", "new_user_registration_def_group", "2");
if($default_group!="")
    $arrGroups = explode(",",$default_group);
?>


© «Bitrix24», 2001-2022
Up