# General routes for the Group module.
group.settings:
  path: '/admin/group/settings'
  defaults:
    _form: '\Drupal\group\Form\GroupSettingsForm'
    _title: 'Group settings'
  requirements:
    _permission: 'administer group'

# Group entity routes.
# Common entity routes are generated by \Drupal\group\Entity\Routing\GroupRouteProvider.
entity.group.join:
  path: '/group/{group}/join'
  defaults:
    _controller: '\Drupal\group\Controller\GroupMembershipController::join'
    _title_callback: '\Drupal\group\Controller\GroupMembershipController::joinTitle'
  requirements:
    _group_permission: 'join group'
    _group_member: 'FALSE'

entity.group.leave:
  path: '/group/{group}/leave'
  defaults:
    _controller: '\Drupal\group\Controller\GroupMembershipController::leave'
  requirements:
    _group_permission: 'leave group'
    _group_member: 'TRUE'

# Group type entity routes.
# Common entity routes are generated by \Drupal\group\Entity\Routing\GroupTypeRouteProvider.
entity.group_type.permissions_form:
  path: '/admin/group/types/manage/{group_type}/permissions'
  defaults:
    _form: '\Drupal\group\Form\GroupPermissionsTypeSpecificForm'
    _title: 'Edit group type permissions'
  requirements:
    _permission: 'administer group'

entity.group_type.outsider_permissions_form:
  path: '/admin/group/types/manage/{group_type}/permissions/outsider'
  defaults:
    _form: '\Drupal\group\Form\GroupPermissionsOutsiderForm'
    _title: 'Edit advanced outsider permissions'
  requirements:
    _permission: 'administer group'

entity.group_type.content_plugins:
  path: '/admin/group/types/manage/{group_type}/content'
  defaults:
    _controller: '\Drupal\group\Entity\Controller\GroupTypeController::content'
    _title: 'Configure available content'
  requirements:
    _permission: 'administer group'

# Group role entity routes.
# Common entity routes are generated by \Drupal\group\Entity\Routing\GroupRoleRouteProvider.
entity.group_role.permissions_form:
  path: '/admin/group/types/manage/{group_type}/roles/{group_role}/permissions'
  defaults:
    _form: '\Drupal\group\Form\GroupPermissionsRoleSpecificForm'
    _title: 'Edit group role permissions'
  requirements:
    _permission: 'administer group'
  options:
      parameters:
        group_type:
          type: 'entity:group_type'

# Group content type entity routes.
# todo Move to group type path when https://www.drupal.org/node/2651974 lands.
# todo When moved, remove the breadcrumb generator.

# todo This route needs a requirement which only allows access if the plugin
#      isn't installed on the group type yet.
entity.group_content_type.add_form:
  path: '/admin/group/content/install/{group_type}/{plugin_id}'
  defaults:
    _entity_form: 'group_content_type.add'
    _title: 'Install content plugin'
  requirements:
    _permission: 'administer group'

entity.group_content_type.edit_form:
  path: '/admin/group/content/manage/{group_content_type}'
  defaults:
    _entity_form: 'group_content_type.edit'
    _title: 'Configure content plugin'
  requirements:
    _permission: 'administer group'

entity.group_content_type.delete_form:
  path: '/admin/group/content/manage/{group_content_type}/uninstall'
  defaults:
    _entity_form: 'group_content_type.delete'
    _title: 'Uninstall content plugin'
  requirements:
    _permission: 'administer group'
