欢迎各位兄弟 发布技术文章
这里的技术是共享的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /*** Implements hook_entity_info().*/function yourmodule_entity_info() { return array( 'name_of_entity' => array( 'label' => t('Name of entity'), 'base table' => 'your_table', 'entity keys' => array( 'id' => 'your_tables_primary_key', ), ), );} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /*** Load a single record.** @param $id* The id representing the record we want to load.*/function examplemodule_load($id, $reset = FALSE) { return examplemodule_load_multiple(array($id), $reset);}/*** Load multiple records.*/function examplemodule_load_multiple($ids = array(), $conditions = array(), $reset = FALSE) { return entity_load('name_of_entity', $ids, $conditions, $reset);} |