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.

Comments

Max Bell’s picture

Assigned: Unassigned » 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.

RobRoy’s picture

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 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?

// 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');
}
// 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);
}
RobRoy’s picture

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?

webchick’s picture

Republished with huge disclaimer. ;)

greggles’s picture

subscribing

Max Bell’s picture

Assigned: Max Bell » Unassigned

*Blanches*

Okay, Rob -- you are WAY ahead of me on this and it's clear I should be helping you. I unassigned myself but plan to keep working through this just the same -- the only way I'll get up on you at this stage is if you never write the docs, though. ;)

RobRoy’s picture

Heh, I know a little bit. Next week, I'll update the docs to try and help get people up-to-speed writing basic install profiles.

bonobo’s picture

subscribing

RobRoy’s picture

Status: Active » Fixed

I updated the docs. Probably needs a once over from somebody else. I left most of webchick's GJG stuff in there and just did a revamp of the top. Setting to fixed, mark as active if it needs more love.

Also, I think we should rename profile's hook_install() to hook_profile_install() for D6. Issue at http://drupal.org/node/101008.

Anonymous’s picture

Status: Fixed » Closed (fixed)