id()); }*/ } /** * Implements hook_schema(). */ function shortcut_schema() { $schema['shortcut_set_users'] = array( 'description' => 'Maps users to shortcut sets.', 'fields' => array( 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The {users}.uid for this set.', ), 'set_name' => array( 'type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => '', 'description' => "The {shortcut_set}.set_name that will be displayed for this user.", ), ), 'primary key' => array('uid'), 'indexes' => array( 'set_name' => array('set_name'), ), 'foreign keys' => array( 'set_user' => array( 'table' => 'users', 'columns' => array('uid' => 'uid'), ), 'set_name' => array( 'table' => 'shortcut_set', 'columns' => array('set_name' => 'set_name'), ), ), ); return $schema; } /** * @addtogroup updates-7.x-to-8.x * @{ */ /** * Migrate shortcuts into configuration. */ function shortcut_update_8000() { $uuid = new Uuid(); $result = db_query('SELECT * from {shortcut_set}'); $ids = array(); foreach ($result as $set) { // Save a config object. if ($set->set_name == 'shortcut-set-1') { // Change default shortcut id. $set->set_name = 'default'; // Update menu links. db_update('menu_links') ->fields(array( 'menu_name' => 'shortcut-default' )) ->condition('menu_name', 'shortcut-set-1') ->execute(); } config('shortcut.set.' . $set->set_name) ->set('id', $set->set_name) ->set('label', $set->title) ->set('uuid', $uuid->generate()) ->save(); $ids[] = $set->set_name; } } /** * Drop the {shortcut_set} table. */ function shortcut_update_8001() { db_drop_table('shortcut_set'); } /** * @} End of "addtogroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */