How do you determine if the current field is required from a fieldtype class? I need to run validation in a custom fieldtype but only if a field is required.

How do you determine if the current field is required from within a fieldtype class?
In Craft 1/2, there isn't a particularly clean or easy way to do this because $this-&gt;model-&gt;required is only set in the context of when it's being called from a field layout.

In the context of a field type, Craft doesn't set it because required is a concept that belongs to a field layout and a given field can belong to multiple field layouts.

This whole process has been refactored and is much cleaner in Craft 3 so that $this-&gt;model-&gt;required works in the context of a field type where you'd expect it to.