You are here

function ds_static_variables in Display Suite 6.3

Same name and namespace in other branches
  1. 6 ds.module \ds_static_variables()
  2. 6.2 ds.module \ds_static_variables()

Set or get static variables at runtime

If passed a key and data, will set the data. If passed only a key, will attempt to retrieve the data and return it.

Parameters

$key: The key to use for the variable

$data: The data to set

Return value

If the key is found, the data, or FALSE. If data is provided, TRUE if the data is set successfully.

3 calls to ds_static_variables()
dsRegionToBlock::block_view in plugins/ds_extension/regiontoblock.inc
plugin block view
dsRegionToBlock::execute in plugins/ds_extension/regiontoblock.inc
execute().
ds_variable_get in ./ds.module
Module-aware version of variable_get

File

./ds.module, line 300

Code

function ds_static_variables($key, $data = NULL) {
  static $variables = array();
  if (!isset($data) && isset($variables[$key])) {
    return $variables[$key];
  }
  elseif (isset($data)) {
    if (!isset($variables[$key])) {
      $variables[$key] = array();
    }
    $variables[$key][] = $data;
    return TRUE;
  }
  return FALSE;
}