Index: modules/profile/profile.install =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v retrieving revision 1.21 diff -u -p -r1.21 profile.install --- modules/profile/profile.install 10 Sep 2009 06:38:19 -0000 1.21 +++ modules/profile/profile.install 19 Sep 2009 13:35:07 -0000 @@ -17,6 +17,97 @@ function profile_uninstall() { * Implement hook_schema(). */ function profile_schema() { + $schema['profile'] = array( + 'description' => 'Stores profile items.', + 'fields' => array( + 'pid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'description' => 'Primary Key: Unique profile item ID.', + ), + 'type' => array( + 'description' => 'The profile category of this profile item.', + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + 'default' => '', + ), + 'uid' => array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => "The {users}.uid of the user this profile item is for. A user's profile is the set of all profile items with their uid.", + ), + ), + 'indexes' => array( + 'pid' => array('pid'), + 'uid' => array('uid'), + ), + /* + // sql minds needed here, I have no idea. + 'unique keys' => array( + 'pid' => array('pid'), + ), + */ + 'primary key' => array('pid'), + ); + + $schema['profile_category'] = array( + 'description' => 'Stores information about all defined {profile} categories.', + 'fields' => array( + 'category' => array( + 'description' => 'The machine-readable name of this category.', + 'type' => 'varchar', + 'length' => 32, + 'not null' => TRUE, + ), + 'name' => array( + 'description' => 'The human-readable name of this category. Used as its label in user profiles.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'description' => array( + 'description' => 'A brief description of this type.', + 'type' => 'text', + 'not null' => TRUE, + 'size' => 'medium', + ), + 'account_display' => array( + 'description' => 'Boolean indicating whether this category should be shown on user accounts.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'size' => 'tiny', + 'default' => '1', + ), + 'body_label' => array( + 'description' => 'The label displayed for the body field on the edit form.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'The weight of this category in relation to other categories.', + ), + ), + 'primary key' => array('type'), + ); + + + + + + + + // @TODO: rest of the schema can die once update functions are written. $schema['profile_field'] = array( 'description' => 'Stores profile field information.', 'fields' => array( Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.274 diff -u -p -r1.274 profile.module --- modules/profile/profile.module 18 Sep 2009 00:04:23 -0000 1.274 +++ modules/profile/profile.module 19 Sep 2009 13:35:08 -0000 @@ -73,9 +73,84 @@ function profile_theme() { } /** + * Implement hook_entity_info(). + */ +function profile_entity_info() { + $return = array( + 'profile' => array( + 'label' => t('Profile'), + //'controller class' => 'UserController', // ? + 'base table' => 'profile', + 'load hook' => 'profile_load', + 'fieldable' => TRUE, + 'object keys' => array( + 'id' => 'pid', + 'bundle' => 'category', + ), + 'bundles' => array(), + ), + ); + // Bundles must provide a human readable name so we can create help and error + // messages, and the path to attach Field admin pages to. + foreach (profile_category_get_names() as $cat => $name) { + $return['profile']['bundles'][$cat] = array( + 'label' => $name, + 'admin' => array( + 'path' => 'admin/config/people/profile/' . str_replace('_', '-', $cat), + 'access arguments' => array('administer profiles'), + ), + ); + } + return $return; +} + +/** + * Get names of profile categories. + * BIG TODO: this is just a dummy function. + * Needs to query the DB! + * Big question: + */ +function profile_category_get_names() { + // @todo: UI to define more categories. + $return = array( + 'profile' => t('Profile'), + ); + return $return; +} + +/** * Implement hook_menu(). */ + // @todo: path should be 'profiles' to match 'accounts'? function profile_menu() { + /* + // TODO: frankencode from node.module + foreach (profile_category_get_names() as $cat => $name) { + $cat_url_str = str_replace('_', '-', $cat); + $items['admin/structure/node-type/' . $cat_url_str] = array( + 'title' => $type->name, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('node_type_form', $type), + 'access arguments' => array('administer content types'), + 'type' => MENU_CALLBACK, + 'file' => 'content_types.inc', + ); + $items['admin/structure/node-type/' . $type_url_str . '/edit'] = array( + 'title' => 'Edit', + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); + $items['admin/structure/node-type/' . $type_url_str . '/delete'] = array( + 'title' => 'Delete', + 'page arguments' => array('node_type_delete_confirm', $type), + 'access arguments' => array('administer content types'), + 'type' => MENU_CALLBACK, + 'file' => 'content_types.inc', + ); + } + */ + + + // old stuff below $items['profile'] = array( 'title' => 'User list', 'page callback' => 'profile_browse', @@ -91,6 +166,11 @@ function profile_menu() { 'access arguments' => array('administer users'), 'file' => 'profile.admin.inc', ); + $items['admin/config/people/profile/settings'] = array( + 'title' => 'Settings', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -10, + ); $items['admin/config/people/profile/add'] = array( 'title' => 'Add field', 'page callback' => 'drupal_get_form',