You are here

protected function OgChangeMultipleRolesFormBase::getGroupTypes in Organic groups 8

Returns an array of group types for which memberships are present.

Return value

array An array of group types, each value an array with two keys:

  • entity_type_id: The entity type ID of the group type.
  • bundle_id: The bundle ID of the group type.
1 call to OgChangeMultipleRolesFormBase::getGroupTypes()
OgAddMultipleRolesForm::buildForm in src/Form/OgAddMultipleRolesForm.php
Form constructor.

File

src/Form/OgChangeMultipleRolesFormBase.php, line 183

Class

OgChangeMultipleRolesFormBase
Base class for forms that act on multiple roles.

Namespace

Drupal\og\Form

Code

protected function getGroupTypes() {
  $group_types = [];
  foreach ($this
    ->getMemberships() as $membership) {
    $group = $membership
      ->getGroup();
    $key = implode('-', [
      $group
        ->getEntityTypeId(),
      $group
        ->bundle(),
    ]);
    $group_types[$key] = [
      'entity_type_id' => $group
        ->getEntityTypeId(),
      'bundle_id' => $group
        ->bundle(),
    ];
  }
  return $group_types;
}