Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: Error when setting a custom field handle as title format in entry type #14498

Closed
lennonpuype opened this issue Feb 29, 2024 · 6 comments
Closed
Labels

Comments

@lennonpuype
Copy link

lennonpuype commented Feb 29, 2024

What happened?

Description

I get an error when setting a custom field as title format. This way I can't access the entry type anymore.
Below are steps to reproduce just like I did things. No idea if the details have anything to do with the actual issue.

Here is a screenshot of the Error message:
Screenshot 2024-02-29 at 14 04 59

Steps to reproduce

  1. Create an entry type with the default field as title format (so keep the toggle on)
  2. Save the entry
  3. Create a matrix field that has that entry type
  4. Assign the matrix field to a section
  5. Fill in the normal matrix field (I did it all in card view)
  6. Save the section/entry
  7. Add another title field (plain text with option for line break)
  8. Make the field required
  9. Set the handle (in my case 'customTitle') as title format
  10. Go and change the content of that title to 'Primary Colours' with a linebreak in stead of the space.
  11. Save the content and an error appears

I have no idea if the error occured before or after adding the linebreak.
The error looks like a parsing or HTML issue?

Expected behavior

Shows the customTitle as the title of the Entry type.

Actual behavior

Gets an error message like above. I can go in the CMS, I just can't get to a moment where this card is being rendered, neither the content of that card. Not as individual page, and not as card

Craft CMS version

5.0.0-beta.3

PHP version

8.2

Operating system and version

OSX Sonoma 14.2.1

Database type and version

mariadb - 10.4

Image driver and version

No response

Installed plugins and versions

  • CKEditor: 4.0.0-beta.7
  • CP Field Inspect: 2.0.0-beta.1
  • Cookies: 5.0.0-beta.1
  • 2 Custom inhouse plugins that don't do anything special. They won't be the reason this happen
  • Minify: 5.0.0-beta.2
  • Vite: 5.0.0-beta.2

Screenshot 2024-02-29 at 14 23 32

brandonkelly added a commit that referenced this issue Feb 29, 2024
@brandonkelly
Copy link
Member

I’m not 100% sure I’m following you on how this is set up, but it might be fixed in 5.0.0-beta.4. Can you try updating to that?

If not, please send a database backup and your composer.json file over to support@craftcms.com.

@lennonpuype
Copy link
Author

I sent the files to support@craftcms.com.

Btw I just noticed that the error only occurs when the matrix that uses this entry type with the custom format title, is set to the cards view.

Maybe that is usefull to know.

@brandonkelly
Copy link
Member

We tracked this down to a bug in CP Field Inspect.

@mmikkel
Copy link
Contributor

mmikkel commented Mar 1, 2024

For posterity, this issue is resolved in CP Field Inspect 2.0.0-beta.2.

@brandonkelly The root problem here was that Html::parseTagAttributes ends up throwing an InvalidHtmlTagException due to the newline in the card tag's data-label attribute. I could be wrong, but AFAIK literal newlines in data attributes isn't considered invalid HTML, so I'm not sure if this should be considered a bug in Craft after all?

brandonkelly added a commit that referenced this issue Mar 1, 2024
@brandonkelly
Copy link
Member

Yeah good point. Just fixed that for the next v4 and v5 releases.

@brandonkelly
Copy link
Member

Craft 4.8.1 and 5.0.0-beta.6 are out with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants