Placeholder with record data and link
I'm trying to use both HtmlString and a closure with the model but I'm not sure what the right syntax should be.
This is the code I've got:
I realize that ->url is not a method on Placeholder elements, but I don't see how to use the HtmlString with the closure to get the content.
Thank you!
3 Replies
In "most" fields, passing certain variable names to the closure will automatically resolve and inject the specified object into the closure. It's based on the variable name, not the model. See https://filamentphp.com/docs/3.x/forms/advanced#form-component-utility-injection
However, that said, since things get sanitized for output, if you generate a URL it's probably going to be url-encoded, not clickable.
For example, if your Panel is named
foo
then this will generate the URL and stick it in the placeholder as plain text:
Got it - thank you!