$grants = static::buildGrantsQueryCondition(node_access_grants('view', $account));
- if (count($grants) > 0 ) {
+ if (count($grants) > 0) {
$query->condition($grants);
}
return $query->execute()->fetchField();
$query = $this->database->insert('node_access')->fields(['nid', 'langcode', 'fallback', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete']);
// If we have defined a granted langcode, use it. But if not, add a grant
// for every language this node is translated to.
+ $fallback_langcode = $node->getUntranslated()->language()->getId();
foreach ($grants as $grant) {
if ($realm && $realm != $grant['realm']) {
continue;
$grant['nid'] = $node->id();
$grant['langcode'] = $grant_langcode;
// The record with the original langcode is used as the fallback.
- if ($grant['langcode'] == $node->language()->getId()) {
+ if ($grant['langcode'] == $fallback_langcode) {
$grant['fallback'] = 1;
}
else {