| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: default.profile,v 1.22 2007/12/17 12:43:34 goba Exp $ 3 4 /** 5 * Return an array of the modules to be enabled when this profile is installed. 6 * 7 * @return 8 * An array of modules to enable. 9 */ 10 function default_profile_modules() { 11 return array('color', 'comment', 'help', 'menu', 'taxonomy', 'dblog'); 12 } 13 14 /** 15 * Return a description of the profile for the initial installation screen. 16 * 17 * @return 18 * An array with keys 'name' and 'description' describing this profile, 19 * and optional 'language' to override the language selection for 20 * language-specific profiles. 21 */ 22 function default_profile_details() { 23 return array( 24 'name' => 'Drupal', 25 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.' 26 ); 27 } 28 29 /** 30 * Return a list of tasks that this profile supports. 31 * 32 * @return 33 * A keyed array of tasks the profile will perform during 34 * the final stage. The keys of the array will be used internally, 35 * while the values will be displayed to the user in the installer 36 * task list. 37 */ 38 function default_profile_task_list() { 39 } 40 41 /** 42 * Perform any final installation tasks for this profile. 43 * 44 * The installer goes through the profile-select -> locale-select 45 * -> requirements -> database -> profile-install-batch 46 * -> locale-initial-batch -> configure -> locale-remaining-batch 47 * -> finished -> done tasks, in this order, if you don't implement 48 * this function in your profile. 49 * 50 * If this function is implemented, you can have any number of 51 * custom tasks to perform after 'configure', implementing a state 52 * machine here to walk the user through those tasks. First time, 53 * this function gets called with $task set to 'profile', and you 54 * can advance to further tasks by setting $task to your tasks' 55 * identifiers, used as array keys in the hook_profile_task_list() 56 * above. You must avoid the reserved tasks listed in 57 * install_reserved_tasks(). If you implement your custom tasks, 58 * this function will get called in every HTTP request (for form 59 * processing, printing your information screens and so on) until 60 * you advance to the 'profile-finished' task, with which you 61 * hand control back to the installer. Each custom page you 62 * return needs to provide a way to continue, such as a form 63 * submission or a link. You should also set custom page titles. 64 * 65 * You should define the list of custom tasks you implement by 66 * returning an array of them in hook_profile_task_list(), as these 67 * show up in the list of tasks on the installer user interface. 68 * 69 * Remember that the user will be able to reload the pages multiple 70 * times, so you might want to use variable_set() and variable_get() 71 * to remember your data and control further processing, if $task 72 * is insufficient. Should a profile want to display a form here, 73 * it can; the form should set '#redirect' to FALSE, and rely on 74 * an action in the submit handler, such as variable_set(), to 75 * detect submission and proceed to further tasks. See the configuration 76 * form handling code in install_tasks() for an example. 77 * 78 * Important: Any temporary variables should be removed using 79 * variable_del() before advancing to the 'profile-finished' phase. 80 * 81 * @param $task 82 * The current $task of the install system. When hook_profile_tasks() 83 * is first called, this is 'profile'. 84 * @param $url 85 * Complete URL to be used for a link or form action on a custom page, 86 * if providing any, to allow the user to proceed with the installation. 87 * 88 * @return 89 * An optional HTML string to display to the user. Only used if you 90 * modify the $task, otherwise discarded. 91 */ 92 function default_profile_tasks(&$task, $url) { 93 94 // Insert default user-defined node types into the database. For a complete 95 // list of available node type attributes, refer to the node type API 96 // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info. 97 $types = array( 98 array( 99 'type' => 'page', 100 'name' => st('Page'), 101 'module' => 'node', 102 'description' => st("A <em>page</em>, similar in form to a <em>story</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."), 103 'custom' => TRUE, 104 'modified' => TRUE, 105 'locked' => FALSE, 106 'help' => '', 107 'min_word_count' => '', 108 ), 109 array( 110 'type' => 'story', 111 'name' => st('Story'), 112 'module' => 'node', 113 'description' => st("A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."), 114 'custom' => TRUE, 115 'modified' => TRUE, 116 'locked' => FALSE, 117 'help' => '', 118 'min_word_count' => '', 119 ), 120 ); 121 122 foreach ($types as $type) { 123 $type = (object) _node_type_set_defaults($type); 124 node_type_save($type); 125 } 126 127 // Default page to not be promoted and have comments disabled. 128 variable_set('node_options_page', array('status')); 129 variable_set('comment_page', COMMENT_NODE_DISABLED); 130 131 // Don't display date and author information for page nodes by default. 132 $theme_settings = variable_get('theme_settings', array()); 133 $theme_settings['toggle_node_info_page'] = FALSE; 134 variable_set('theme_settings', $theme_settings); 135 136 // Update the menu router information. 137 menu_rebuild(); 138 } 139 140 /** 141 * Implementation of hook_form_alter(). 142 * 143 * Allows the profile to alter the site-configuration form. This is 144 * called through custom invocation, so $form_state is not populated. 145 */ 146 function default_form_alter(&$form, $form_state, $form_id) { 147 if ($form_id == 'install_configure') { 148 // Set default for site name field. 149 $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME']; 150 } 151 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |