You are here

function commerce_bpc_setting in Commerce Bulk Product Creation 7.2

Same name and namespace in other branches
  1. 7 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.

13 calls to commerce_bpc_setting()
bpc_display_commerce_bpc_destinations_alter in modules/bpc_display/bpc_display.module
Implements hook_commerce_bpc_destinations_alter().
bpc_display_commerce_bpc_post_create in modules/bpc_display/bpc_display.module
Implements hook_commerc_bpc_post_create().
bpc_display_form_commerce_bpc_create_bulk_form_alter in modules/bpc_display/bpc_display.module
Implements hook_form_FORM_ID_alter().
bpc_display_select_node_type in modules/bpc_display/bpc_display.forms.inc
Menu callback: Display list of node types or redirect to node type form.
bpc_display_settings_form in modules/bpc_display/bpc_display.admin.inc
Form constructor for the commerce_bpc display node settings page.

... See full list

File

./commerce_bpc.settings.inc, line 43
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;
}