function _opigno_form_og_node_form_alter in Opigno 7.0
Helper function for altering OG forms
Parameters
array &$form:
array $form_state:
string $type:
1 call to _opigno_form_og_node_form_alter()
- opigno_form_course_node_form_alter in ./
opigno.module  - Implements hook_form_FORM_ID_alter()
 
File
- ./
opigno.module, line 229  - Contains all hook_implementations and module specific API.
 
Code
function _opigno_form_og_node_form_alter(&$form, $form_state, $type) {
  if (!isset($form['#node']->nid)) {
    $node = (object) array(
      'nid' => 0,
    );
  }
  else {
    $node = clone $form['#node'];
  }
  $form['tools'] = array(
    '#type' => 'fieldset',
    '#title' => $type == 'course' ? t("Course tools") : t("Workgroup tools"),
  );
  $tools = array();
  // We need a type on the node. Add one if it's empty (node/add form)
  if (!isset($node->type)) {
    $node->type = $form['type']['#value'];
  }
  foreach (opigno_get_og_tools($node, FALSE) as $tool => $tool_info) {
    $tools[$tool] = $tool_info['tool_name'];
  }
  $form['tools']['tools_activate'] = array(
    '#type' => 'checkboxes',
    '#title' => t("Choose which tools to activate"),
    '#options' => $tools,
    '#default_value' => variable_get('opigno_og_tools_nid_' . $node->nid, array()),
  );
  if (!isset($form['#submit'])) {
    $form['#submit'] = array();
  }
  $form['#submit'][] = '_opigno_form_og_node_form_alter_submit';
}