function services_client_migrate_get_mapping_info in Services Client 7.2
Retrieve field mapping info. Detect weather type of mapping is field or simple property.
Parameters
string $name: Mapping name.
Return value
array Field description.
1 call to services_client_migrate_get_mapping_info()
- services_client_migrate_add_mapping in ./
services_client.legacy.inc - Create mapping plugins by old configurration.
File
- ./
services_client.legacy.inc, line 292 - Contains functions required for automated converting old Services Client version 1 hooks to events. This file is included only in drush command 'services-client-migrate-hooks'.
Code
function services_client_migrate_get_mapping_info($name) {
$match = array();
// field_name#>und#>0#>value
if (preg_match('~^(?P<field_name>[\\w_]+)#>(?P<language>\\w+)#>\\d?#>(?P<property>[\\w_]+)$~i', $name, $match)) {
return array(
'type' => SERVICES_CLIENT_FIELD_TYPE_FIELD,
'data' => array(
'field' => $match['field_name'],
'language' => $match['language'],
'property' => $match['property'],
),
);
}
elseif (preg_match('~^(?P<property>[\\w_]+)$~i', $name, $match)) {
return array(
'type' => SERVICES_CLIENT_FIELD_TYPE_PROPERTY,
'data' => array(
'property' => $match['property'],
),
);
}
elseif (preg_match('~^(?P<field_name>[\\w_]+)#>\\d?#>(?P<property>[\\w_]+)$~i', $name, $match)) {
return array(
'type' => SERVICES_CLIENT_FIELD_TYPE_D6_FIELD,
'data' => array(
'field' => $match['field_name'],
'language' => $match['language'],
'property' => $match['property'],
),
);
}
elseif (preg_match('~^(?P<field_name>[\\w_]+)#>(?P<language>\\w+)$~i', $name, $match)) {
return array(
'type' => SERVICES_CLIENT_FIELD_TYPE_FIELD_MULTI,
'data' => array(
'field' => $match['field_name'],
'language' => $match['language'],
),
);
}
else {
return array(
'type' => SERVICES_CLIENT_FIELD_TYPE_UNKNOWN,
);
}
}