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