Closed ericras closed 7 years ago
$grp_membership_service = \Drupal::service('group.membership_loader');
$grps = $grp_membership_service->loadByUser($user);
foreach ($grps as $grp) {
$groups[] = $grp->getGroup();
}
Their aren't any hooks for this in the 8.x version (as you alluded to), so we'll likely have to add a patch to support this kind of folder permission injection at http://cgit.drupalcode.org/imce/tree/src/Imce.php?h=8.x-1.x#n107
There may not be hooks, but there are plugins!
I made a PR that implements a plugin that will accomplish this: https://github.com/unlcms/imce_groups/pull/1
In Drupal 7, the following could be pasted after "/" in the IMCE settings UI:
In doesn't look like the D8 version of IMCE supports putting php in the text box. It supports tokens but there's not a [current-user:groups] token. Tokens are kind of meant for a single value, not an array. This probably needs to be accomplished in code.