public function AccessCheck::isAnyPermissionSetForTerm in Permissions by Term 8.2
Same name and namespace in other branches
- 8 src/Service/AccessCheck.php \Drupal\permissions_by_term\Service\AccessCheck::isAnyPermissionSetForTerm()
Parameters
int $tid:
string $langcode:
Return value
bool
3 calls to AccessCheck::isAnyPermissionSetForTerm()
- AccessCheck::canUserAccessByNode in src/
Service/ AccessCheck.php - AccessCheck::isAccessAllowedByDatabase in src/
Service/ AccessCheck.php - AccessChecker::isAccessControlled in modules/
permissions_by_entity/ src/ Service/ AccessChecker.php - Checks if the given entity uses terms with access restrictions.
File
- src/
Service/ AccessCheck.php, line 201
Class
- AccessCheck
- AccessCheckService class.
Namespace
Drupal\permissions_by_term\ServiceCode
public function isAnyPermissionSetForTerm($tid, $langcode = '') {
$langcode = $langcode === '' ? \Drupal::languageManager()
->getCurrentLanguage()
->getId() : $langcode;
$iUserTableResults = (int) $this->database
->query("SELECT COUNT(1) FROM {permissions_by_term_user} WHERE tid = :tid AND langcode = :langcode", [
':tid' => $tid,
':langcode' => $langcode,
])
->fetchField();
$iRoleTableResults = (int) $this->database
->query("SELECT COUNT(1) FROM {permissions_by_term_role} WHERE tid = :tid AND langcode = :langcode", [
':tid' => $tid,
':langcode' => $langcode,
])
->fetchField();
if ($iUserTableResults > 0 || $iRoleTableResults > 0) {
return TRUE;
}
}