You are here

function og_vocab_element_after_build in OG Vocabulary 7

After build; Remove the "Add more" button.

1 string reference to 'og_vocab_element_after_build'
OgVocab::getFormElement in includes/og_vocab.og_vocab.inc
Return form element.

File

includes/og_vocab.og_vocab.inc, line 246
A class used for messages.

Code

function og_vocab_element_after_build($form, &$form_state) {
  foreach (array_keys(og_vocab_get_og_vocab_fields($form['#entity_type'], $form['#bundle'])) as $field_name) {
    if (empty($form[$field_name][LANGUAGE_NONE][0])) {

      // Field has no reference, so we can hide it.
      continue;
    }
    $form[$field_name][LANGUAGE_NONE]['#theme'] = '';
    unset($form[$field_name][LANGUAGE_NONE]['add_more']);
    unset($form[$field_name][LANGUAGE_NONE][0]['_weight']);
    $form[$field_name][LANGUAGE_NONE]['#theme_wrappers'] = array(
      'fieldset',
    );
    $form[$field_name][LANGUAGE_NONE]['#title'] = '';
  }
  return $form;
}