With this change, it'll be easier to incorporate the plugin. For example, I was using fields with type url everywhere and once I started using toHtml() I began to get errors for undefined index "type" and "link". Besides, the $field->yaml() function was called twice, which was redundant.
With this, you can use toHtml() on fields of type url and text as well.
If no valid value can be found, it will simply return a blank value. You'll know the link is broken/missing when it leads you nowhere.
I always checked if link is defined in the template/snippet code. That way I could either display the button or not. But I agree an empty value is cleaner.
With this change, it'll be easier to incorporate the plugin. For example, I was using fields with type
url
everywhere and once I started usingtoHtml()
I began to get errors for undefined index "type" and "link". Besides, the$field->yaml()
function was called twice, which was redundant.With this, you can use
toHtml()
on fields of typeurl
andtext
as well.If no valid value can be found, it will simply return a blank value. You'll know the link is broken/missing when it leads you nowhere.