diff --git a/statuses.module b/statuses.module index 21afbb7..3c2c6ee 100644 --- a/statuses.module +++ b/statuses.module @@ -279,6 +279,55 @@ function statuses_permission() { } /** + * Implements hook_entity_info(). + */ +function statuses_entity_info() { + return array( + 'status' => array( + 'label' => t('Status'), + 'plural label' => t('Statuses'), + 'description' => t('A status update.'), + 'entity class' => 'StatusEntity', + 'controller class' => module_exists('entity') ? 'EntityAPIController' : 'DrupalDefaultEntityController', + 'base table' => 'statuses', + 'load hook' => 'statuses_load', + 'uri callback' => 'statuses_uri', + 'module' => 'statuses', + 'entity keys' => array( + 'id' => 'sid', + 'label' => 'message', + ), + 'bundles' => array( + 'status' => array( + 'label' => t('Status'), + ), + ), + 'view modes' => array( + 'full' => array( + 'label' => t('Status message'), + 'custom settings' => FALSE, + ), + ), + 'entity cache' => FALSE, + ), + ); +} + +function statuses_uri($status) { + return array( + 'path' => 'statuses/' . $status->sid, + ); +} + +if (class_exists('Entity')) { + class StatusEntity extends Entity { + public function __construct(array $values = array(), $entityType = NULL) { + parent::__construct($values, 'status'); + } + } +} + +/** * Implements hook_user_cancel(). */ function statuses_user_cancel($edit, $account, $method) {