Field access & denominator are marking map item fields access as forbidden

Created on 5 May 2025, 16 days ago

Problem/Motivation

This module provides field access hook which is based upon property `denominator` to determine access rights.

The problem is that Drupal core `Map` - \Drupal\Core\Field\Plugin\Field\FieldType\MapItem field type have simple getter
```
/**
* {@inheritdoc}
*/
public function __get($name) {
if (!isset($this->values[$name])) {
$this->values[$name] = [];
}

return $this->values[$name];
}
```

Which in conjunction with `webform_score_entity_field_access` is going to mark any Map field type as forbidden.

```
if (!$items || !$items[0] || is_null($items[0]->denominator)) {
return AccessResult::neutral();
}

if (!$items[0]->denominator) {
// No scoring is configured.
return AccessResult::forbidden()->cachePerPermissions();
}

```

Steps to reproduce

Proposed resolution

We should check by field type initiall, if is not fraction, that access is neutral

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇭🇷Croatia valic Osijek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024