function ref_field_decode in (Entity)Reference Field Synchronization 7
Returns machine friendly information for a ref_field autocomplete form field
Parameters
$value: A string as returned by ref_field_encode().
Return value
An associative array containing:
- entity_type: the entity type
- id: the entity ID
Or FALSE if not match was found
1 call to ref_field_decode()
- ref_field_field_widget_validate in ./
ref_field.module - FAPI validation of an individual element.
File
- ./
ref_field.module, line 670
Code
function ref_field_decode($value) {
$matches = array();
preg_match('`\\| ([a-z_]+):([0-9]+)$`', $value, $matches);
$return = FALSE;
// Check for a valid match
if (isset($matches[1]) && isset($matches[2])) {
$return = array(
'entity_type' => $matches[1],
'id' => $matches[2],
);
}
return $return;
}