function cf_db_options_get_options_list in Common Functionality 7.2
Returns a list of options.
This is only a list of the machine_name and human_name of the select lists. Use this for populating select lists, radio buttons, and check boxes.
Parameters
string $table: A machine name that is prefixed onto the table. This is often either the name of the module or the name of the table associated with the options.
string $name: The machine name of the options and is suffixed onto the table.
array|null $options: (optional) Providing a valid array of options as returned by cf_db_options_get_options() and it will be properly converted into a options list.
Return value
An array of supported options. The array keys are the standard machine name and the array value is the human name.
See also
Related topics
1 call to cf_db_options_get_options_list()
- cf_settings_get_variable_types_list in modules/
cf_settings/ cf_settings.module - Get an array of supported variable type options list.
File
- modules/
cf_db_options/ cf_db_options.module, line 394 - Common Functionality - Database Options module.
Code
function cf_db_options_get_options_list($table, $name, $options = NULL) {
if (cf_is_empty_or_non_string('table', $table, WATCHDOG_ERROR)) {
return array();
}
if (cf_is_empty_or_non_string('name', $name, WATCHDOG_ERROR)) {
return array();
}
if (is_null($options)) {
$options = cf_db_options_get_options($table, $name, NULL);
}
elseif (!is_array($options)) {
if (class_exists('cf_error')) {
cf_error::invalid_array('options');
}
return array();
}
$options_list = array();
foreach ($options as $machine_name => $value) {
if (!is_object($value)) {
continue;
}
$options_list[$value->machine_name] = $value->human_name;
}
return $options_list;
}