default.profile

File

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