Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I would like to retrieve the Group ID before the referencing node is created. It seems that the ID could be parsed from the URL or retrieved from the $form_state
array like so:
function my_module_form_alter(&$form, &$form_state, $form_id) {
$gid = $form_state['entityreference_prepopulate']['foo_entity_type']['bar_bundle_type']['og_group_ref'][0];
}
Is this the right method or is there a builtin function I should be leveraging instead?
Thanks
Comments
Comment #1
amitaibuYou can use
og_context()
.Comment #2
eft CreditAttribution: eft commentedAh, ok. Another module to add to my platform. Thanks :)
Comment #3
eft CreditAttribution: eft commentedclosing