function wsconfig_context_wsconfig_convert in Web Service Data 7
1 string reference to 'wsconfig_context_wsconfig_convert'
- wsconfig.inc in modules/
wsconfig/ plugins/ contexts/ wsconfig.inc
File
- modules/
wsconfig/ plugins/ contexts/ wsconfig.inc, line 105
Code
function wsconfig_context_wsconfig_convert($context, $type) {
if ($context->empty) {
return NULL;
}
if (!$context->data['wsdata_run']) {
$context->data['wsconfig'] = wsconfig_load_by_name($context->data['conf']['wsconfig']);
$replacements = json_decode($context->data['conf']['replacements'], TRUE);
foreach ($replacements as $key => $val) {
if (substr($key, 0, 1) != '%') {
$replacements['%' . $key] = $val;
unset($replacements[$key]);
}
}
$method = $context->data['conf']['wsconfig_method_' . $context->data['conf']['wsconfig']];
$arguments = empty($context->data['conf']['arguments']) ? array() : json_decode($context->data['conf']['arguments'], TRUE);
$options = empty($context->data['conf']['options']) ? array() : json_decode($context->data['conf']['options'], TRUE);
$result = $context->data['wsconfig']
->call($method, $replacements, $arguments, $options);
$context->data['wsprocessor'] = new $context->data['conf']['wsprocessor']($result);
$context->data['wsdata_run'] = TRUE;
}
switch ($type) {
case 'wsprocessor':
return $context->data['wsprocessor'];
break;
case 'wsconfig':
return $context->data['wsconfig'];
break;
default:
return $context->data['wsprocessor']
->getData($type);
}
return NULL;
}