Refactor box.php to fix #315

The goal is to be able to apply the same filter over any type of item,
while passing the connection type to the parameter.

This is not possible with the P2P_Field_Create class.