function commerce_bpc_setting in Commerce Bulk Product Creation 7
Same name and namespace in other branches
- 7.2 commerce_bpc.settings.inc \commerce_bpc_setting()
Retrieves a value form the variable table.
Parameters
string $group: The settings group of the setting to be retrieved.
string $varname: The name of the variable to retrieve.
string $type: (optional) if set to the machine name of a product type, the function will check if a product type specific version of the value exists (i.e. a variable with the name '$varname . '_' . $product_type).
Return value
mixed If $product_type is set and a product type specific value exists, it it will be returned. Otherwise, the non-specific value will be returned. failing that, a default value will be returned.
12 calls to commerce_bpc_setting()
- CommerceBpcSettingsTest::testSettingAndRetrievingSettings in ./
commerce_bpc.test - Tests saving and retrieval of settings.
- commerce_bpc_create_bulk_form in ./
commerce_bpc.forms.inc - Form constructor for the bulk creation form.
- commerce_bpc_create_bulk_form_create_products_submit in ./
commerce_bpc.forms.inc - Form submission handler for commerce_bpc_create_bulk_form().
- commerce_bpc_create_bulk_form_display_node in ./
commerce_bpc.forms.inc - Menu callback: Display list of node types or redirect to node type form.
- commerce_bpc_create_bulk_form_validate in ./
commerce_bpc.forms.inc - Form validation hanlder for for commerce_bpc_create_bulk_form().
File
- ./
commerce_bpc.settings.inc, line 53 - Helper functions for settings-related functionality.
Code
function commerce_bpc_setting($group, $varname, $type = NULL) {
// We short-circuit the look-up of defaults and global settings for 'override'
// settings, for in this case, they do not make sense.
if ($varname == 'override') {
return variable_get('commerce_bpc_' . $group . '_override_' . $type, FALSE);
}
$defaults = commerce_bpc_setting_defaults();
$value = isset($defaults[$group][$varname]) ? $defaults[$group][$varname] : NULL;
$varname = 'commerce_bpc_' . $group . '_' . $varname;
$value = variable_get($varname, $value);
if (!empty($type) && commerce_bpc_setting($group, 'override', $type)) {
$value = variable_get($varname . '_' . $type, $value);
}
return $value;
}