You are here

protected function GroupContentUninstallValidator::hasGroupContent in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/UninstallValidator/GroupContentUninstallValidator.php \Drupal\group\UninstallValidator\GroupContentUninstallValidator::hasGroupContent()

Determines if there is any group content for a group relation plugin.

Parameters

string $plugin_id: The group relation plugin ID to check for group content.

Return value

bool Whether there are group content entities for the given plugin ID.

1 call to GroupContentUninstallValidator::hasGroupContent()
GroupContentUninstallValidator::validate in src/UninstallValidator/GroupContentUninstallValidator.php
Determines the reasons a module can not be uninstalled.

File

src/UninstallValidator/GroupContentUninstallValidator.php, line 75

Class

GroupContentUninstallValidator

Namespace

Drupal\group\UninstallValidator

Code

protected function hasGroupContent($plugin_id) {
  $group_content_types = array_keys(GroupContentType::loadByContentPluginId($plugin_id));
  if (empty($group_content_types)) {
    return FALSE;
  }
  $entity_count = $this->entityTypeManager
    ->getStorage('group_content')
    ->getQuery()
    ->accessCheck(FALSE)
    ->condition('type', $group_content_types, 'IN')
    ->count()
    ->execute();
  return (bool) $entity_count;
}