Entity System - Property Field

What is Field Entity? Field entity is a PHP class for wrapping all operations such as creating, updating and disabling the property field system. It is recommended to use the class object when trying to manipulate the field system as many logic and hooks is will be invoked inside the class object.

What is property field? Property field is a programatically coded features for a property type, The fields is mapped by property field system array which is alterable via hooks. Only use Field system when you have a complex features that a property attributes system cannot handle. For example you need a field of price for your property types which can handle currencies, can be searched with maximum and minimum price entry etc.

Where does a property field stores its data? Property field system data entry can be stored in taxonomy as taxonomy terms either hierarchical or not, custom post meta and a serialized _property_data post meta. It all depends on how you register the field and what is defined in the field configuration array. Available Hook actions Property plugin Type Entity is alterable via hooks :

Hook Action – vtcore_property_field_init This hook is invoked as the last action when the field entity object constructed.

Hook Action – vtcore_property_field_after_entity_load This action is invoked after the field entity object loads the field system configuration array from field system configuration objects (VTCore_Property_Fields())

Hook Action – vtcore_property_field_after_entity_save This action is triggered after the field entity object saving the field system configuration array to WordPress options vtcore_property_fields database table

Hook Action – vtcore_property_field_after_entity_delete This action is triggered after the field entity object removes current field custom configuration from database. Note that the only way to truly remove a hard coded field completely from the field system is using hook action vtcore_property_field_register

Example on altering field entity

 * Hooking into type entity init hook 
add_action('vtcore_property_field_init', 'alter_my_field'); 

function alter_my_field($object) { 

   * Use dotted notation and object getter
   * Just a simple demonstration to change all the 
   * type form label
  $object->mutate('label', 'Newly altered label');

   * Changing visibility globally
   * Turn off the icon visibility
  $object->mutate('visibility.icon', false);