cms icon indicating copy to clipboard operation
cms copied to clipboard

Select Field - Frontend output - All entities using key value

Open palmersoft-uk opened this issue 1 year ago • 0 comments

Bug description

Screenshot 2024-08-23 at 21 10 14

Select field added to collection, multi select enabled, values as per screenshot above.

I then created an entry in the collection and added three categories.

Screenshot 2024-08-23 at 21 29 00

The output uses the label value as expected.

On the frontend, the key, value, and label entities are all using the key.

{{ dump:categories }}

Produces

array:3 [▼
  0 => array:3 [▼
    "key" => "employers"
    "value" => "employers"
    "label" => "employers"
  ]
  1 => array:3 [▼
    "key" => "news"
    "value" => "news"
    "label" => "news"
  ]
  2 => array:3 [▼
    "key" => "job-seekers"
    "value" => "job-seekers"
    "label" => "job-seekers"
  ]
]

I am expecting the label entity to use the value I specified in the blueprint.

How to reproduce

Latest version of statamic.

Create a collection.

Edit the blueprint.

Add a select field.

Add some options to the select field, ensuring that the key and label are set, and that the label is different to the key.

Create at least one entity in the collection and ensure you select an option in the select field.

On the frontend, output the collection, for each entity ensure you output the select field, or dump the field.

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.20.0
PHP Version: 8.2.22
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: annecorder.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.23.0 PRO

Statamic Addons
aerni/font-awesome: 3.0.1
aryehraber/statamic-captcha: 1.12.1
ndx/statamic-bard-color-picker: 2.0.0

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

palmersoft-uk avatar Aug 23 '24 20:08 palmersoft-uk