Field System - Field Hooks
Property plugin Fields System is alterable via hooks :
Hook Filter – vtcore_property_alter_fields This filter allows you to modify, remove or add fields into the field registration, It will be fired when VTCore_Property_Fields object is created
Hook Action – vtcore_property_field_registered This action is triggered after fields object is created and it is the last action in the register method, the field object is passed by reference
Hook Action – vtcore_property_field_load This action is triggered after fields array loaded from database, the field object is passed by reference
Hook Action – vtcore_property_field_save This action is triggered after fields array saved to database, the field object is passed by reference
Hook Action – vtcore_property_field_delete This action is triggered after fields array deleted from database, the field object is passed by reference
Example on altering fields array
/** Adding the new Field to Property Field system **/
add_filter('vtcore_property_alter_fields', 'register_my_field');
function register_my_field($registry) {
/**
* Modify the field registry via $registry
* This will disable the property status
*/
$registry['property_status']['enabled'] = false;
return $registry;
}
/**
* We use object instead of direct array via _register action
* Remember that this action is called after everything else (eg. WPML integration)
*/
add_action('vtcore_property_field_register', 'modify_field_object');
function modify_field_object($fieldObject) {
/**
* $fieldObject is the field object and it inherits the VTCore_Wordpress_Models_Config
* Thus it can use dotted notation for the array key drilling and has the getter and setter
* Method inherited as well.
*/
/** this will disable the property status **/
$fieldObject->mutate('property_status.enabled', false);
}