You are here

function og_form_alter in Organic groups 6

Same name and namespace in other branches
  1. 5.8 og.module \og_form_alter()
  2. 5 og.module \og_form_alter()
  3. 5.2 og.module \og_form_alter()
  4. 5.3 og.module \og_form_alter()
  5. 5.7 og.module \og_form_alter()
  6. 6.2 og.module \og_form_alter()
  7. 7 og.module \og_form_alter()

File

./og.module, line 1722

Code

function og_form_alter(&$form, &$form_state, $form_id) {

  // Add audience selection to node forms
  if (isset($form['#node']) && $form_id == $form['#node']->type . '_node_form') {
    $node = $form['#node'];
    if (og_is_group_type($node->type)) {
      $form = array_merge($form, og_group_form($node, $form_state));

      // Don't trample on custom label.
      if (isset($form['body_field']) && $form['body_field']['body']['#title'] == t('Body')) {
        $form['body_field']['body']['#title'] = t('Mission statement');
        $form['body_field']['body']['#description'] = t('A welcome greeting for your group home page. Consider listing the group objectives and mission.');
      }
      $form['author']['name']['#title'] = t('Group manager');
      $form['options']['sticky']['#title'] = t('Sticky at top of group home page and other lists.');
    }
    elseif (og_is_group_post_type($node->type)) {
      if ($group_node = og_get_group_context()) {
        $bc = og_get_breadcrumb($group_node);
        if (isset($node->nid)) {
          $bc[] = l($node->title, "node/{$node->nid}");
        }
        drupal_set_breadcrumb($bc);
      }
      og_form_add_og_audience($form, $form_state);
    }
  }
}