You are here

function rules_get_data_object in Rules 6

Gets the right data object for the given argument information

Parameters

$info: Info about the data type.

$data: Optional data to set. Warning: Only use this, when loosing a reference is ok.

6 calls to rules_get_data_object()
rules_admin_default_argument_form in rules_admin/rules_admin.rule_forms.inc
Returns the argument form for the given element
rules_get_element_variable in rules/rules.variables.inc
Gets a variable for the given element which uses an own input form.
rules_input_evaluator_php_help in rules/modules/php.rules_forms.inc
Returns some help for the admin using the evaluator
rules_pack_variables in rules/rules.variables.inc
Packs the given variables ready for serialization. Data types which are identifiable are replaced by their identifiers and loaded fresh from the db when the variables are unpacked.
rules_unpack_variables in rules/rules.variables.inc
Unacks the given packed variables.

... See full list

File

rules/rules.data_types.inc, line 16
Defines the data type class

Code

function rules_get_data_object($info, $data = NULL) {
  $class = 'rules_data_type';
  if (($data_type = rules_get_data_types($info['type'])) && class_exists($data_type['class'])) {
    $class = $data_type['class'];
  }
  $object = new $class();
  $object
    ->construct($info['type'], isset($data_type) ? $data_type : array());
  if (isset($data)) {
    $object
      ->init($data);
  }
  return $object;
}