Super Image Markers stores one JSON value in Craft's element content storage.
{
"imageId": 123,
"markers": [
{
"uid": "marker-abc",
"x": 42.25,
"y": 61.5,
"entryId": 456,
"color": "#d92828"
}
]
}imageId is the selected Craft asset ID. The reference is restricted to image assets and supports one(), all(), and isEmpty().
{% set image = entry.entryMapperField.image.one() %}
{% set hasImage = not entry.entryMapperField.image.isEmpty() %}markers is an ordered array.
Each marker includes:
uid - stable unique ID for Control Panel editing.x - horizontal percentage.y - vertical percentage.entryId - related Craft entry ID, or null.color - marker color as a normalized hex string.{% set markers = entry.entryMapperField.markers.all() %}
{% set hasMarkers = not entry.entryMapperField.markers.isEmpty() %}{{ item.marker.x }}
{{ item.marker.y }}
{{ item.marker.color }}
{{ item.marker.entryId }}
{{ item.marker.entry.one().title }}By default, image.one() and each marker.entry.one() resolve references on demand. For frontend templates with multiple markers, call process() once before rendering:
{% set mapper = entry.entryMapperField.process() %}
{% if not mapper.image.isEmpty() and not mapper.markers.isEmpty() %}
{% set image = mapper.image.one() %}
{% for item in mapper.markers.all() %}
{% set relatedEntry = item.marker.entry.one() %}
{% endfor %}
{% endif %}process() returns the same value-object API, but preloads the image and all marker entries in batches. Existing code such as mapper.image.one(), mapper.markers.all(), and item.marker.entry.one() continues to work.
If an entry is disabled, deleted, or otherwise not returned by the frontend element query, item.marker.entry.one() returns null after processing.
The field data belongs to the element that owns the field, so JSON content storage keeps the plugin simple:
The field accepts:
ImageMarkersData objects.It normalizes all valid input into an ImageMarkersData object.
{# Empty values serialize to null. #}
[
'imageId' => 123,
'markers' => [
[
'uid' => 'marker-abc',
'x' => 42.25,
'y' => 61.5,
'entryId' => 456,
'color' => '#d92828',
],
],
]The field validates references before saving:
imageId must be a valid image asset.entryId values must be valid entries.Coordinates are normalized to two decimal places and clamped to the 0 to 100 range. Colors are normalized to valid #rrggbb strings.