You are here

function rules_variable::construct in Rules 6

Constructor

Parameters

$state The current evaluation state:

$name The name of the given variable:

$data If available, the actual data, else NULL.:

$info If given, the info for the variable. If not given it will be retrieved: from the current's set info.

Return value

If the variable name isn't valid, FALSE.

File

rules/rules.variables.inc, line 287
Provides functions and classes for handling variables

Class

rules_variable
Handles loading and saving a variable

Code

function construct(&$state, $name, &$data, $info = NULL) {
  $this->_state =& $state;
  $info = isset($info) ? $info : $state['set_info']['arguments'][$name];
  if (isset($info)) {
    $this->info = $info + array(
      'saved' => FALSE,
      'handler' => '',
    );
    $this->name = $name;
    $this
      ->_set_data($data);
    $state['variables'][$name] =& $this;
    return TRUE;
  }
  return FALSE;
}