You are here

public function RestfulDataProviderVariable::viewVariable in RESTful 7

View a single variable.

Parameters

string $name_string: A string of variable names, separated by commas.

1 call to RestfulDataProviderVariable::viewVariable()
RestfulDataProviderVariable::view in plugins/restful/RestfulDataProviderVariable.php
View a variable or multiple variables.

File

plugins/restful/RestfulDataProviderVariable.php, line 131
Contains \RestfulDataProviderDbQuery

Class

RestfulDataProviderVariable
@file Contains \RestfulDataProviderDbQuery

Code

public function viewVariable($name) {

  // Caching is done on the individual variables.
  $cache_id = array(
    'tb' => 'variable',
    'id' => $name,
  );
  $cached_data = $this
    ->getRenderedCache($cache_id);
  if (!empty($cached_data->data)) {
    return $cached_data->data;
  }
  $variable['name'] = $name;
  $variable['value'] = variable_get($name);
  $return = $this
    ->mapVariableToPublicFields($variable);
  $this
    ->setRenderedCache($return, $cache_id);
  return $return;
}