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