Steps to reproduce:
1.- In a node with paragraphs, add a new paragraph item but don't save the node yet.
3.- Click Preview button.
You will receive the follow error:
"TypeError: Argument 2 passed to Drupal\permissions_by_term\Cache\AccessResultCache::hasAccessResultsCache() must be of the type int, null given, called in /var/www/html/project/docroot/modules/contrib/permissions_by_term/modules/permissions_by_entity/permissions_by_entity.module on line 26 in Drupal\permissions_by_term\Cache\AccessResultCache->hasAccessResultsCache() (line 61 of modules/contrib/permissions_by_term/src/Cache/AccessResultCache.php)."
The problem:
In the line 26 ist not being checked if the entity is new or already exists. In this case, the new paragraph has not been saved yet and doesn't have an id.
if ($operation === 'view' && $entity instanceof FieldableEntityInterface) {
The if condition should check whether the entity is a new entity or not.
if ($operation === 'view' && $entity instanceof FieldableEntityInterface && !$entity->isNew()) {
Regards
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Error-on-preview-a-node-with-unsaved-paragraphs-3143429.patch | 855 bytes | juagarc4 |
Comments
Comment #2
juagarc4 commentedComment #3
juagarc4 commentedComment #4
jepster_@juagarc4: Thanks for sharing your thoughts!
I could not reproduce that on a bare Drupal instance with latest PbT and Paragraphs installed. It might be related to any project specifics:
However, the extended check is good. I will apply it.
Comment #6
jepster_The patch is applied and contained in PbT version 8.x-2.24: https://www.drupal.org/project/permissions_by_term/releases/8.x-2.24
Thanks!
Comment #7
jepster_