function entityreference_prepopulate_get_values_from_cache in Entityreference prepopulate 7
Get the values from the cached form.
Parameters
$field: The field info array.
$instance: The instance info array.
See also
entityreference_prepopulate_get_values()
1 call to entityreference_prepopulate_get_values_from_cache()
- entityreference_prepopulate_get_values in ./
entityreference_prepopulate.module - Wrapper function to get context (e.g. from URL or OG-context).
File
- ./
entityreference_prepopulate.module, line 334 - Prepopulate entity reference values from URL.
Code
function entityreference_prepopulate_get_values_from_cache($field, $instance) {
// Try to get the form out of cache.
if (!($form_build_id = isset($_GET['form_build_id']) ? $_GET['form_build_id'] : isset($_POST['form_build_id']) ? $_POST['form_build_id'] : NULL)) {
return;
}
$field_name = $field['field_name'];
$form_state = array();
form_get_cache($form_build_id, $form_state);
// If successful, get the value from the form_state.
return isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name]) ? $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name] : FALSE;
}