You are here

function styles_variable_get in Styles 7.2

Same name and namespace in other branches
  1. 6.2 includes/styles.variables.inc \styles_variable_get()
  2. 6 includes/styles.variables.inc \styles_variable_get()

Wrapper for variable_get() using the Styles variable registry.

Parameters

string $name: The variable name to retrieve. Note that it will be namespaced by pre-pending STYLES_NAMESPACE, as to avoid variable collisions with other modules.

unknown $default: An optional default variable to return if the variable hasn't been set yet. Note that within this module, all variables should already be set in the styles_variable_default() function.

Return value

unknown Returns the stored variable or its default.

See also

styles_variable_set()

styles_variable_del()

styles_variable_default()

File

includes/styles.variables.inc, line 60
styles.variables.inc Variable defaults for Styles.

Code

function styles_variable_get($name, $default = NULL) {

  // Allow for an override of the default.
  // Useful when a variable is required (like $path), but namespacing is still
  // desired.
  if (!isset($default)) {
    $default = styles_variable_default($name);
  }

  // Namespace all variables.
  $variable_name = STYLES_NAMESPACE . $name;
  return variable_get($variable_name, $default);
}