Entity System - Property Type

What is Type Entity? Type entity is a PHP class for managing property type entity Create Revise Update and Delete process. The purpose of this class is to act as the general gateway object for other to use.

What is property type? Property type is actually a Taxonomy with Terms that is mapped in a single options table entry as serialized array. The maps will act as the key for storing types additional options such as bundled Fields and Attributes. Which allows user to have different settings and bundles for each different kind of types. Available Hook actions Property plugin Type Entity is alterable via hooks :

Hook Action – vtcore_property_type_init This hook is invoked as the last action when the type entity is constructed.

Hook Action – vtcore_property_type_after_entity_load This action is invoked after the type entity object finished loading type entity data from database into the object.

Hook Action – vtcore_property_type_before_entity_save This action is triggered before the type entity object attempt to update the stored entity entry in the database.

Hook Action – vtcore_property_type_after_entity_save This action is triggered after the type entity object performing saving type array into the database regardless whether the saving process is success or failed.

Hook Action – vtcore_property_type_before_entity_delete This action is triggered before the actual data removal from the database.

Hook Action – vtcore_property_type_after_entity_delete This action is triggered after the data is removed from the database.

Example on altering types entity

 

/**
 * Hooking into type entity init hook 
 */
add_action('vtcore_property_type_init', 'alter_my_type'); 

function alter_my_type($object) { 

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