You are here

function og_vocab_relation_save in OG Vocabulary 7

Save relation between a vocabulary and a group.

5 calls to og_vocab_relation_save()
OgVocabApiTestCase::setUp in ./og_vocab.test
Sets up a Drupal site for running functional and integration tests.
OgVocabComplexWidgetTestCase::setUp in ./og_vocab.test
Sets up a Drupal site for running functional and integration tests.
OgVocabMenuAccessTestCase::testAccess in ./og_vocab.test
Test access to vocabulary.
OgVocabUnbindFromContentType::testUnbindContentType in ./og_vocab.test
When a vocabulary is related to a bundle and it's term are reference to the group content, un-bind it from the bundle the terms should not be reference any more to the node.
og_vocab_form_taxonomy_form_vocabulary_submit in ./og_vocab.module
Submit handler; Save the OG-vocab record.

File

./og_vocab.module, line 725
Give each group its own system controlled vocabularies.

Code

function og_vocab_relation_save($vid, $group_type, $gid) {
  if ($og_vocab = og_vocab_relation_get($vid)) {
    if ($og_vocab->group_type != $group_type || $og_vocab->gid != $gid) {
      throw new OgVocabException('Vocabulary ID is already associated with another group.');
    }
    return;
  }
  $og_vocab = array(
    'vid' => $vid,
    'group_type' => $group_type,
    'gid' => $gid,
  );
  drupal_write_record('og_vocab_relation', $og_vocab);
}