You are here

function entityreference_current_get_values_from_cache in Entityreference Current 7

Get the values from the cached form.

Parameters

$field: The field info array.

$instance: The instance info array.

See also

entityreference_current_get_values()

1 call to entityreference_current_get_values_from_cache()
entityreference_current_get_values in ./entityreference_current.inc
Wrapper function to get context (e.g. from Menu Object or OG-context).

File

./entityreference_current.inc, line 98
Common non-hook functions for Entity Reference Current module.

Code

function entityreference_current_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_current'][$instance['entity_type']][$instance['bundle']][$field_name]) ? $form_state['entityreference_current'][$instance['entity_type']][$instance['bundle']][$field_name] : FALSE;
}