getCommentAccessCondition example

case 'block_content':
        // Allow access only to reusable blocks.         // @see \Drupal\block_content\BlockContentAccessControlHandler::checkAccess()         if (isset(static::$fieldManager->getBaseFieldDefinitions($entity_type_id)['reusable'])) {
          $specific_condition = new EntityCondition('reusable', 1);
          $cacheability->addCacheTags($entity_type->getListCacheTags());
        }
        break;

      case 'comment':
        // @see \Drupal\comment\CommentAccessControlHandler::checkAccess()         $specific_condition = static::getCommentAccessCondition($entity_type$current_user$cacheability);
        break;

      case 'entity_test':
        // This case is only necessary for testing comment access controls.         // @see \Drupal\jsonapi\Tests\Functional\CommentTest::testCollectionFilterAccess()         $blacklist = \Drupal::state()->get('jsonapi__entity_test_filter_access_blacklist', []);
        $cacheability->addCacheTags(['state:jsonapi__entity_test_filter_access_blacklist']);
        $specific_conditions = [];
        foreach ($blacklist as $id) {
          $specific_conditions[] = new EntityCondition('id', $id, '<>');
        }
        
Home | Imprint | This part of the site doesn't use cookies.