You are here

function og_complex_widget_after_build in Organic groups 7.2

After build; Remove the "Add more" button.

See also

field_multiple_value_form()

theme_field_multiple_value_form()

1 string reference to 'og_complex_widget_after_build'
og_field_widget_form in includes/og.field.inc
Implements hook_field_widget_form().

File

includes/og.field.inc, line 339
Field widget related code for Organic groups.

Code

function og_complex_widget_after_build($form, &$form_state) {
  foreach (og_get_group_audience_fields($form['#entity_type'], $form['#bundle']) as $field_name => $value) {
    if (empty($form[$field_name])) {
      continue;
    }
    unset($form[$field_name][LANGUAGE_NONE]['#theme']);
    unset($form[$field_name][LANGUAGE_NONE]['add_more']);
    unset($form[$field_name][LANGUAGE_NONE][0]['_weight']);
    if ($form[$field_name][LANGUAGE_NONE]['#required']) {
      $form[$field_name][LANGUAGE_NONE]['#title'] .= ' ' . theme('form_required_marker', array());
    }
    if (!empty($form[$field_name][LANGUAGE_NONE][0]['admin'])) {

      // Wrap both elements with a fieldset.
      $form[$field_name][LANGUAGE_NONE]['#theme_wrappers'] = array(
        'fieldset',
      );
    }
  }
  return $form;
}