function entityreference_prepopulate_get_values_from_url in Entityreference prepopulate 7
Get values for prepopulating fields via URL.
Parameters
$field: The field info array.
$instance: The instance info array.
See also
entityreference_prepopulate_get_values()
2 string references to 'entityreference_prepopulate_get_values_from_url'
- entityreference_prepopulate_providers_info in ./
entityreference_prepopulate.module - Return array of providers.
- hook_entityreference_prepopulate_providers_info in ./
entityreference_prepopulate.api.php - Register a new prepopulate provider.
File
- ./
entityreference_prepopulate.module, line 360 - Prepopulate entity reference values from URL.
Code
function entityreference_prepopulate_get_values_from_url($field, $instance) {
$settings = $instance['settings']['behaviors']['prepopulate'];
$field_identifier = empty($settings['identifier']) ? $field['field_name'] : $settings['identifier'];
if (!empty($_GET[$field_identifier]) && is_string($_GET[$field_identifier])) {
return explode(',', $_GET[$field_identifier]);
}
}