You are here

function entityreference_prepopulate_get_values_from_og_context in Entityreference prepopulate 7

Get values for prepopulating fields OG-context.

Parameters

$field: The field info array.

$instance: The instance info array.

See also

entityreference_prepopulate_get_values()

1 string reference to 'entityreference_prepopulate_get_values_from_og_context'
entityreference_prepopulate_providers_info in ./entityreference_prepopulate.module
Return array of providers.

File

./entityreference_prepopulate.module, line 381
Prepopulate entity reference values from URL.

Code

function entityreference_prepopulate_get_values_from_og_context($field, $instance) {
  $field_name = $field['field_name'];
  if (!module_exists('og_context') || !($og_context = og_context())) {
    return;
  }
  if ($og_context['group_type'] != $field['settings']['target_type']) {

    // Context is of invalid group-type.
    return;
  }
  return array(
    $og_context['gid'],
  );
}