<?php

// $Id$

/**
 * @file
 * Handles the interaction between organic groups and the project module.
 */


/**
 * Implementation of hook_help().
 */
function og_project_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      return t('Allows projects to work with organic groups.');
  }
}


/**
 * Modify the project follow-up form to include the OG audience so
 * that replying to an issue doesn't wipe out the audience 
 */
function og_project_form_alter($form_id, &$form) {
  if ($form_id != 'project_comment_form') {
    return;
  }
  if (in_array('project_issue', variable_get('og_omitted', array()))) {
    return;
  }

  if (!isset($form['#node'])) { 
    $form['#node'] = node_load(arg(3));
  }

  og_form_add_og_audience($form_id, $form);

  // make sure the buttons come *after* all the OG stuff
  $form['submit']['#weight'] = 50;
  $form['preview']['#weight'] = 50;
}
