webmaster@1: 'Drupal',
webmaster@1: 'description' => 'Select this profile to enable some basic Drupal functionality and the default theme.'
webmaster@1: );
webmaster@1: }
webmaster@1:
webmaster@1: /**
webmaster@1: * Return a list of tasks that this profile supports.
webmaster@1: *
webmaster@1: * @return
webmaster@1: * A keyed array of tasks the profile will perform during
webmaster@1: * the final stage. The keys of the array will be used internally,
webmaster@1: * while the values will be displayed to the user in the installer
webmaster@1: * task list.
webmaster@1: */
webmaster@1: function default_profile_task_list() {
webmaster@1: }
webmaster@1:
webmaster@1: /**
webmaster@1: * Perform any final installation tasks for this profile.
webmaster@1: *
webmaster@1: * The installer goes through the profile-select -> locale-select
webmaster@1: * -> requirements -> database -> profile-install-batch
webmaster@1: * -> locale-initial-batch -> configure -> locale-remaining-batch
webmaster@1: * -> finished -> done tasks, in this order, if you don't implement
webmaster@1: * this function in your profile.
webmaster@1: *
webmaster@1: * If this function is implemented, you can have any number of
webmaster@1: * custom tasks to perform after 'configure', implementing a state
webmaster@1: * machine here to walk the user through those tasks. First time,
webmaster@1: * this function gets called with $task set to 'profile', and you
webmaster@1: * can advance to further tasks by setting $task to your tasks'
webmaster@1: * identifiers, used as array keys in the hook_profile_task_list()
webmaster@1: * above. You must avoid the reserved tasks listed in
webmaster@1: * install_reserved_tasks(). If you implement your custom tasks,
webmaster@1: * this function will get called in every HTTP request (for form
webmaster@1: * processing, printing your information screens and so on) until
webmaster@1: * you advance to the 'profile-finished' task, with which you
webmaster@1: * hand control back to the installer. Each custom page you
webmaster@1: * return needs to provide a way to continue, such as a form
webmaster@1: * submission or a link. You should also set custom page titles.
webmaster@1: *
webmaster@1: * You should define the list of custom tasks you implement by
webmaster@1: * returning an array of them in hook_profile_task_list(), as these
webmaster@1: * show up in the list of tasks on the installer user interface.
webmaster@1: *
webmaster@1: * Remember that the user will be able to reload the pages multiple
webmaster@1: * times, so you might want to use variable_set() and variable_get()
webmaster@1: * to remember your data and control further processing, if $task
webmaster@1: * is insufficient. Should a profile want to display a form here,
webmaster@1: * it can; the form should set '#redirect' to FALSE, and rely on
webmaster@1: * an action in the submit handler, such as variable_set(), to
webmaster@1: * detect submission and proceed to further tasks. See the configuration
webmaster@1: * form handling code in install_tasks() for an example.
webmaster@1: *
webmaster@1: * Important: Any temporary variables should be removed using
webmaster@1: * variable_del() before advancing to the 'profile-finished' phase.
webmaster@1: *
webmaster@1: * @param $task
webmaster@1: * The current $task of the install system. When hook_profile_tasks()
webmaster@1: * is first called, this is 'profile'.
webmaster@1: * @param $url
webmaster@1: * Complete URL to be used for a link or form action on a custom page,
webmaster@1: * if providing any, to allow the user to proceed with the installation.
webmaster@1: *
webmaster@1: * @return
webmaster@1: * An optional HTML string to display to the user. Only used if you
webmaster@1: * modify the $task, otherwise discarded.
webmaster@1: */
webmaster@1: function default_profile_tasks(&$task, $url) {
webmaster@1:
webmaster@1: // Insert default user-defined node types into the database. For a complete
webmaster@1: // list of available node type attributes, refer to the node type API
webmaster@1: // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
webmaster@1: $types = array(
webmaster@1: array(
webmaster@1: 'type' => 'page',
webmaster@1: 'name' => st('Page'),
webmaster@1: 'module' => 'node',
webmaster@1: 'description' => st("A page, similar in form to a story, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a page entry does not allow visitor comments and is not featured on the site's initial home page."),
webmaster@1: 'custom' => TRUE,
webmaster@1: 'modified' => TRUE,
webmaster@1: 'locked' => FALSE,
webmaster@1: 'help' => '',
webmaster@1: 'min_word_count' => '',
webmaster@1: ),
webmaster@1: array(
webmaster@1: 'type' => 'story',
webmaster@1: 'name' => st('Story'),
webmaster@1: 'module' => 'node',
webmaster@1: 'description' => st("A story, similar in form to a page, 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 story entry. By default, a story entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
webmaster@1: 'custom' => TRUE,
webmaster@1: 'modified' => TRUE,
webmaster@1: 'locked' => FALSE,
webmaster@1: 'help' => '',
webmaster@1: 'min_word_count' => '',
webmaster@1: ),
webmaster@1: );
webmaster@1:
webmaster@1: foreach ($types as $type) {
webmaster@1: $type = (object) _node_type_set_defaults($type);
webmaster@1: node_type_save($type);
webmaster@1: }
webmaster@1:
webmaster@1: // Default page to not be promoted and have comments disabled.
webmaster@1: variable_set('node_options_page', array('status'));
webmaster@1: variable_set('comment_page', COMMENT_NODE_DISABLED);
webmaster@1:
webmaster@1: // Don't display date and author information for page nodes by default.
webmaster@1: $theme_settings = variable_get('theme_settings', array());
webmaster@1: $theme_settings['toggle_node_info_page'] = FALSE;
webmaster@1: variable_set('theme_settings', $theme_settings);
webmaster@1:
webmaster@1: // Update the menu router information.
webmaster@1: menu_rebuild();
webmaster@1: }
webmaster@1:
webmaster@1: /**
webmaster@1: * Implementation of hook_form_alter().
webmaster@1: *
webmaster@1: * Allows the profile to alter the site-configuration form. This is
webmaster@1: * called through custom invocation, so $form_state is not populated.
webmaster@1: */
webmaster@1: function default_form_alter(&$form, $form_state, $form_id) {
webmaster@1: if ($form_id == 'install_configure') {
webmaster@1: // Set default for site name field.
webmaster@1: $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME'];
webmaster@1: }
webmaster@1: }