private function checkGroupContentCreateAccess($gid, User $account, EntityInterface $entity) {
    $group = Group::load($gid);

    if ($group->hasPermission('create group_' . $entity->getEntityTypeId() . ':' . $entity->bundle() . ' entity', $account)) {
      if ($group->getGroupType()->id() === 'public_group') {
        $config = $this->configFactory->get('entity_access_by_field.settings');
        if ($config->get('disable_public_visibility') === 1 && !$account->hasPermission('override disabled public visibility')) {
          return FALSE;
        }
      }
      return TRUE;
    }
    return FALSE;
  }
private function checkGroupContentCreateAccess($gid, User $account, EntityInterface $entity) {
    $group = Group::load($gid);

    if ($group->hasPermission('create group_' . $entity->getEntityTypeId() . ':' . $entity->bundle() . ' entity', $account)) {
      if ($group->getGroupType()->id() === 'public_group') {
        $config = $this->configFactory->get('entity_access_by_field.settings');
        if ($config->get('disable_public_visibility') === 1 && !$account->hasPermission('override disabled public visibility')) {
          return FALSE;
        }
      }
      return TRUE;
    }
    return FALSE;
  }
private function checkGroupContentCreateAccess ( $ gid , User $ account , EntityInterface $ entity ) { $ group = Group :: load ( $ gid ) ; if ( $ group -> hasPermission ( 'create group_' . $ entity -> getEntityTypeId ( ) . ':' . $ entity -> bundle ( ) . ' entity' , $ account ) ) { if ( $ group -> getGroupType ( ) -> id ( ) === 'public_group' ) { $ config = $ this -> configFactory -> get ( 'entity_access_by_field.settings' ) ; if ( $ config -> get ( 'disable_public_visibility' ) === 1 && ! $ account -> hasPermission ( 'override disabled public visibility' ) ) { return FALSE ; } } return TRUE ; } return FALSE ; }
Check if user may create content of bundle in group.

@param int $gid
Group id.
@param \Drupal\user\Entity\User $account
The user to check for.
@param \Drupal\Core\Entity\EntityInterface $entity
The node bundle to check for.

@return int
Either TRUE or FALSE.
Check if user may create content of bundle in group .