Posts

Showing posts from May, 2015

Drupal Entity reference

Entity Type ======== Node, User, File, Taxonomy Bundles ===== Article Page 1. You need to create a Entity Controller to do CRUD operation with database table 2. To create a simple custom entity you need following functions hook_entity_info() hook_entity_property_info() An interface which extends DrupalEntityControllerInterface  A Controller class which extends DrupalDefaultEntityController and  implements above Interface 3. Entity API provide some easy functions to interact with entity in code like entity_save, entity_create, entity_delete, etc. 4. Look at the following function in Entity.module. We can save an entity by writing a 'save callback' or writing Controller. Not sure what method_exists($entity, 'save') expects function entity_save($entity_type, $entity) {   $info = entity_get_info($entity_type);   if (method_exists($entity, 'save')) {     return $entity->save();   }   elseif (isset($info['save ca...