So, I'm in the process of building a fieldtype, and I'd like to output an HTML element and some javascript when a developer calls my plugin like this:
{{ entry.fieldtypeHandle }}
The field returns an object with other methods/properties on it, but I'd like to specifically provide something different when a developer calls my fieldtype without any other chaining.
I've tried pass a class with a __toString()
method, but it just returns a string. (I don't know what I expected, honestly.) I also know that coupling the HTML output with the class seems a bit dirty, even if that did work.
Is this possible?