X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FNodeGrantDatabaseStorage.php;fp=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FNodeGrantDatabaseStorage.php;h=b4947c9f123e4b46acb36b5b26d4efee5363d91d;hp=993d0950d1a29a0e3899908c8030aaa452609a91;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/node/src/NodeGrantDatabaseStorage.php b/web/core/modules/node/src/NodeGrantDatabaseStorage.php index 993d0950d..b4947c9f1 100644 --- a/web/core/modules/node/src/NodeGrantDatabaseStorage.php +++ b/web/core/modules/node/src/NodeGrantDatabaseStorage.php @@ -138,7 +138,7 @@ class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface { $grants = static::buildGrantsQueryCondition(node_access_grants('view', $account)); - if (count($grants) > 0 ) { + if (count($grants) > 0) { $query->condition($grants); } return $query->execute()->fetchField(); @@ -211,6 +211,7 @@ class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface { $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; @@ -227,7 +228,7 @@ class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface { $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 {