[documentation] [Documentation bug] Install profiles docs seem outdated/incorrect

webchick drupal-docs at drupal.org
Fri Nov 24 14:49:21 UTC 2006


Issue status update for 
http://drupal.org/node/94010
Post a follow up: 
http://drupal.org/project/comments/add/94010

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Max Bell
 Reported by:  RobRoy
 Updated by:   webchick
 Status:       active

Republished with huge disclaimer. ;)




webchick



Previous comments:
------------------------------------------------------------------------

Fri, 10 Nov 2006 07:42:16 +0000 : RobRoy

http://drupal.org/node/67921 talks about hook_install_configure and
friends, but I can't seem to find where this hook is triggered. I tried
adding it to my .profile file, but it's not getting called and a search
for 'install_configure' in the code comes up blank.


I want to get this install profile stuff going, and will update the
docs if someone sets me straight.




------------------------------------------------------------------------

Fri, 24 Nov 2006 07:32:21 +0000 : Max Bell

Have begun gathering resources and info to bring the installation
profiles documentation into 2006-2007, I hope to have this done soon but
do not plan to stop working on it for considerably longer.


If you have suggestions/ideas/want to provide feedback, test, what have
you, please join us in http://groups.drupal.org/distributions -- my
intentions are good, and beyond that, I'm not claiming I know what I'm
doing, just that I have a computer, too much free time, and a vested
interest in seeing installation profiles bring new markets to Drupal and
expand on those using the product today.




------------------------------------------------------------------------

Fri, 24 Nov 2006 07:50:16 +0000 : RobRoy

I'm going to post this here instead of at the group, but the following
is a sample education install profile I've begun writing for School
Engine [1] which I'm going to port over to Drupal. 


Since I found out hook_configure isn't in the installer it took a
little different solution to add my own form to the post-install
process. Just thought I'd include this as a mini-example and hope it
helps clarify anything even though it's not really filled out. Webchick
probably has a more filled out example?


<?php
// school_engine_basic.profile

/**
 * Implementation of hook_profile_modules().
 * 
 * Return an array of the modules to be enabled when this profile is installed.
 *
 * @return
 *  An array of modules to be enabled.
 */
function school_engine_basic_profile_modules() {
  // Core modules.
 
$modules = array('block', 'color', 'comment', 'filter', 'help', 'menu', 'node', 'system', 'taxonomy', 'user', 'watchdog',
   
'og', 'og_vocab', 'views', 'views_rss', // School Engine modules.
    'school_engine', // School Engine core modules.
    'devel', // Other modules.
  );

  return $modules;
}

/**
 * Implementation of hook_profile_details().
 * 
 * Return a description of the profile.
 */
function school_engine_basic_profile_details() {
  return array(
    'name' => 'School Engine - Basic',
   
'description' => 'Select this profile to enable some basic School Engine functionality and the default theme.',
  );
}

/**
 * Implementation of hook_install().
 */
function school_engine_basic_install() {
  drupal_goto('school_engine_install_configure');
}
?>


<?php
// school_engine.module
/**
 * Implementation of hook_menu().
 */
function school_engine_menu($may_cache) {
  $items = array();

  if ($may_cache) {
   
$items[] = array('path' => 'school_engine_install_configure', 
      'title' => t('School Engine Configuration'),
      'callback' => 'drupal_get_form', 
     
'callback arguments' => array('school_engine_install_form'),
      'access' => TRUE, 
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}

/**
 * FAPI callback; generate install form.
 */
function school_engine_install_form() {
  $form = array();
  
  $form['include_sample_data'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include sample data'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}

/**
 * FAPI callback; validation for install form.
 */
function school_engine_install_form_validate($form_id, $form_values) {
  // Validate here.
}

/**
 * FAPI callback; submit for install form.
 */
function school_engine_install_form_submit($form_id, $form_values) {
  if ($form_values['include_sample_data']) {
    _school_engine_install_sample_data();
  }
}

/**
 * Helper function to install sample data.
 */
function _school_engine_install_sample_data() {
  // Create sample taxonomy vocabularies and terms.
  $form_values = array(
    'name' => t('Course categories'),
    'nodes' => array('page' => 'page'),
    'multiple' => TRUE,
  );
  drupal_execute('taxonomy_form_vocabulary', $form_values);

  // Create sample groups and test posts.
  $form_values = array(
    'title' => t('Test course'),
    'body' => t('Test course description'),
  );
  $node = new StdClass();
  $node->type = 'group';
  drupal_execute('node_form', $form_values, $node);
}
?>
[1] http://www.schoolengine.com




------------------------------------------------------------------------

Fri, 24 Nov 2006 07:55:21 +0000 : RobRoy

Webchick, I'm on the docs team but can't edit that installer page as
it's unpublished. Can you publish it again or give me rights so I/we can
help edit it?






More information about the documentation mailing list