function cf_settings_is_registered in Common Functionality 7.2
Determine if a variable is registered or not.
Parameters
string $variable_name:: A string or an array of strings that are represent the names of variables to load.
null|string $variable_type:: A numeric id or an array of numeric ids that are represent the types of variables to load. If null is given, then the variable type is not used.
Return value
bool TRUE is returned when the variable name (or variable name + variable type) is registered and FALSE otherwise.
Related topics
2 calls to cf_settings_is_registered()
- cf_settings_register in modules/
cf_settings/ cf_settings.module - Add a variable name and type to the variables registry.
- cf_settings_unregister in modules/
cf_settings/ cf_settings.module - Remove a registered variable from the variables registry.
File
- modules/
cf_settings/ cf_settings.module, line 394 - Common Functionality - PHP INI module.
Code
function cf_settings_is_registered($variable_name, $variable_type = NULL) {
if (!is_string($variable_name) || empty($variable_name)) {
return FALSE;
}
if (!is_null($variable_type) && (!is_string($variable_type) || empty($variable_type))) {
return FALSE;
}
$conditions = array(
'variable_name' => $variable_name,
);
if (!is_null($variable_type)) {
$conditions['variable_type'] = $variable_type;
}
$registered = cf_settings_get_registered($conditions);
return !empty($registered);
}