Skip to content
Snippets Groups Projects

Issues/3101344: Check fallback value for new translations.

Closed AKHIL BABU requested to merge issue/drupal-3101344:3101344-check-fallback into 11.x
All threads resolved!
Files
4
@@ -82,10 +82,16 @@ public function access(NodeInterface $node, $operation, AccountInterface $accoun
@@ -82,10 +82,16 @@ public function access(NodeInterface $node, $operation, AccountInterface $accoun
$query->addExpression('1');
$query->addExpression('1');
// Only interested for granting in the current operation.
// Only interested for granting in the current operation.
$query->condition('grant_' . $operation, 1, '>=');
$query->condition('grant_' . $operation, 1, '>=');
// Check for grants for this node and the correct langcode.
// Check for grants for this node and the correct langcode. New translations
 
// do not yet have a langcode and must check the fallback node record.
$nids = $query->andConditionGroup()
$nids = $query->andConditionGroup()
->condition('nid', $node->id())
->condition('nid', $node->id());
->condition('langcode', $node->language()->getId());
if (!$node->isNewTranslation()) {
 
$nids->condition('langcode', $node->language()->getId());
 
}
 
else {
 
$nids->condition('fallback', 1);
 
}
// If the node is published, also take the default grant into account. The
// If the node is published, also take the default grant into account. The
// default is saved with a node ID of 0.
// default is saved with a node ID of 0.
$status = $node->isPublished();
$status = $node->isPublished();
Loading