You are here

public function Subgroup::defaultConfiguration in Subgroup (Graph) 1.0.x

File

src/Plugin/GroupContentEnabler/Subgroup.php, line 62

Class

Subgroup
Provides a content enabler for subgroups.

Namespace

Drupal\ggroup\Plugin\GroupContentEnabler

Code

public function defaultConfiguration() {
  $config = parent::defaultConfiguration();
  $config['entity_cardinality'] = 1;

  // Default parent_role_mapping.
  if ($this
    ->getGroupType()) {
    $parent_roles = $this
      ->getGroupType()
      ->getRoles();
    foreach ($parent_roles as $role_id => $role) {
      $config['parent_role_mapping'][$role_id] = NULL;
    }
  }

  // Default child_role_mapping.
  if ($this
    ->getSubgroupType()) {
    $child_roles = $this
      ->getSubgroupType()
      ->getRoles();
    foreach ($child_roles as $role_id => $role) {
      $config['child_role_mapping'][$role_id] = NULL;
    }
  }
  return $config;
}