Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Previously:
foreach ($wrapper->{$field_name . '__og_membership'}->value() as $og_membership) {
$gids[] = $og_membership->gid;
}
Now:
$target_type = $field['settings']['target_type'];
$gids = og_get_entity_groups($entity_type, $entity, array(), $field_name);
$gids = !empty($gids[$target_type]) ? $gids[$target_type] : array();
As you can see, $gids
used to be keyed by a simple numeric index, 0, 1, 2, etc. Now they're keyed by og_membership IDs. In most cases this is probably fine, but pathauto tokens seem to rely on the normal numeric index. That is, tokens in the format of [node:og-group-ref:0:...]
no longer function.
Comment | File | Size | Author |
---|---|---|---|
#1 | og-gids-pathauto-tokens-2395659-1.patch | 634 bytes | alexdmccabe |
Comments
Comment #1
alexdmccabeHere's a patch that should solve this issue.
Comment #2
brad.bulger CreditAttribution: brad.bulger commentedarray_values()
already produces a numerically ordered array. what's the purpose of the subsequentarray_merge()
call? i get it as a change to the original code line (that's still in 2.7)but the current line (from 2.x-dev and the patch file here)
should be sufficient on its own, no?