dotCMS / dotCMS/core

[DEFECT] Key-Value fields in Widgets are converted to Strings instead of Maps

Open
#33,876 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OKR : Customer Support Team : Maintenance
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Problem Statement

When rendering a widget, Key-Value fields are being exposed to the Velocity context as plain strings instead of Map objects. This prevents any standard map operations and causes inconsistent behavior compared to regular content types.

Steps to Reproduce

Steps to Reproduce

  1. Create a Content Type with a Key-Value field (e.g., questionList).
  2. Create a Widget using this Content Type.
  3. Add one or more key-value pairs (e.g., a=Value A, b=Value B).
  4. Place the widget on a page or render it directly.
  5. In the widget’s Velocity code, print the field and attempt to access keys:
  6. $questionList

$questionList.a
$questionList.get("a")
$questionList.map.entrySet()

Observe that:

$questionList prints as a raw string: {a=Value A, b=Value B}
All key-based operations return null or errors
Map iteration fails completely

Acceptance Criteria

Key-Value fields inside widgets should behave like they do in standard content:

Return a proper Map<String, Object>
Support $field.key
Support $field.get("key")
Support iteration via .map.entrySet() or .keys

dotCMS Version

Latest evergreen

Severity

Medium - Some functionality impacted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the widget rendering path with a Content Type containing a Key-Value field, then inspect how that field is exposed in the Velocity context. Compare it with standard content behavior and the documented $dotcontent.find($ContentInode) workaround. Done means the widget exposes a Map<String, Object> supporting key access, get(), and iteration as listed in the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.