Improved code formatting.
Issue #2342103 by kolier: Fixed Uncaught TypeError: Cannot read property 'length' of undefined.
Issue #2362645 by kolier: Fixed Non standard hook_field_info() implementation cause variant hidden issues.
Issue #2289633 by bircher, timofey: Fixed JS Error - "Not Found".
Issue #2329443 by DamienMcKenna: Added CTools argument.
Issue #2257357 by rudiedirkx: Added Context condition.
Revert "Issue #2257357 by rudiedirkx: Added Context condition."

This reverts commit 438671de464477dca17cce021b042e58cd8215d7.
Revert "Revert "Issue #2257357 by rudiedirkx: Added Context condition.""

This reverts commit ec1374763ecd055ee44b4f1bcb45b32e519a0ef2.