You are here

function system_patterns_export_all_variables in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_components/components/system.inc \system_patterns_export_all_variables()

File

patterns_components/components/system.inc, line 65

Code

function system_patterns_export_all_variables($args = NULL, &$result = NULL) {

  // Taken from the Devel module.
  $query = db_select('variable', 'v')
    ->extend('TableSort');
  $query
    ->fields('v', array(
    'name',
    'value',
  ));
  $qresult = $query
    ->execute();
  $actions = array(
    PATTERNS_CREATE => array(
      'tag' => 'variables',
    ),
  );
  foreach ($qresult as $row) {
    $name = $row->name;
    $value = variable_get($name);
    $action = array(
      'name' => $name,
      'value' => $value,
    );
    array_push($actions[PATTERNS_CREATE], $action);
  }
  $result = array(
    $actions,
  );
  return $result;
}