Skip to content

[5.x]: Entry Type CP icons are directly inherited by entries on the front end #16077

@astuteo

Description

@astuteo

What happened?

Description

Entries belonging to entry types that have been given CP icons inherit those icons on the front end. Maybe this is intended in Craft 5, but it's quite confusing.

Steps to reproduce

  1. Create a new section with a new entry type and give it a custom CP icon
  2. Create an entry in that section
  3. {{ entry.icon }} will return the string value of the entry type's CP icon on the front end

Expected behavior

I would expect one or more of the following:

  • The field to not exist if it has not been created, so I can apply an appropriate and expected conditional for non-existence
  • The icon to exist, but on the type, such as {{ entry.type.icon }}

Actual behavior

  • If your entry type does not have a custom icon field created for it, it will still return a string value for {{ entry.icon }} from the entry type's meta icon value.

Craft CMS version

5.4.9

PHP version

8.3

Operating system and version

Mac OS Sonoma 14.6.1

Database type and version

MySQL 8.0.36

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions