Implemented filtering used pages in toggle states

When unique values is on, the toggle states now only returns unused pages for the field.
In order to acheive this, I've move the current implementation of toggleStates into a private method to preserve the current behavior and also be able to customize toggle states.

This change also makes sure to cache field data to avoid repeating the same SQL query if possible, since the data can be shared across multiple entries for the same field (and across field instance too)