/**
  * Revert to previous settings after scenario execution.
  *
  * @AfterScenario
  */
 public function removeVocabularies()
 {
     // Remove the vocabularies.
     foreach ($this->vocabularies as $vocabulary_name) {
         taxonomy_vocabulary_delete($this->getTaxonomyIdByName($vocabulary_name));
     }
 }
Example #2
0
 /**
  * Delete a vocabulary.
  *
  * @param string $machine_name
  *    Vocabulary machine name.
  *
  * @return bool|int
  *   Constant indicating items were deleted.
  */
 public function deleteVocabulary($machine_name)
 {
     if ($vocabulary = taxonomy_vocabulary_machine_name_load($machine_name)) {
         return taxonomy_vocabulary_delete($vocabulary->vid);
     } else {
         return FALSE;
     }
 }
 public function deleteExistingObject(NodeInterface $node, Context $context, $dirtyAllowed = false)
 {
     /* @var $node EntityNode */
     $bundle = $node->getBundle();
     $vocabulary = taxonomy_vocabulary_machine_name_load($bundle);
     $exists = (int) db_query("SELECT 1 FROM {taxonomy_term_data} d WHERE d.vid = :vid", [':vid' => $vocabulary->vid]);
     if ($exists) {
         $context->logDataloss(sprintf("%s: taxonomy vocabulary has terms", $node->getPath()));
     }
     taxonomy_vocabulary_delete($vocabulary->vid);
 }
Example #4
0
$PAGE->set_title($site->fullname);
$PAGE->navbar->add(get_string('navbartaxonomy', 'local_taxonomy'), new moodle_url('/local/taxonomy/index.php'));
$vocabularyshortname = $vocabulary->shortname;
if (!$delete) {
    $strdeletecheck = get_string("deletecheck", "", $vocabulary->name);
    $strdeletecoursecheck = get_string("vocabulary:delete:confirm", 'local_taxonomy');
    $PAGE->navbar->add($strdeletecheck);
    $PAGE->set_title("{$site->shortname}: {$strdeletecheck}");
    $PAGE->set_heading($site->fullname);
    echo $OUTPUT->header();
    $message = "{$strdeletecoursecheck}<br/><br/><b style=\"margin-left:80px;\">" . $vocabulary->name . "</b>";
    echo $OUTPUT->confirm($message, "VocabularyDeletePage.php?id={$vocabulary->id}&delete=" . md5($vocabulary->shortname), "/local/taxonomy/index.php");
    echo $OUTPUT->footer();
    exit;
}
if ($delete != md5($vocabulary->shortname)) {
    print_error("invalidmd5");
}
if (!confirm_sesskey()) {
    print_error('confirmsesskeybad', 'error');
}
// OK checks done, delete the course now.
$strdeletingcourse = get_string("deletingcourse", "", $vocabularyshortname);
$PAGE->navbar->add($strdeletingcourse);
$PAGE->set_title("{$site->shortname}: {$strdeletingcourse}");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($strdeletingcourse);
taxonomy_vocabulary_delete($vocabulary);
echo $OUTPUT->continue_button("/local/taxonomy/index.php");
echo $OUTPUT->footer();
 /**
  * Delete test vocabulary.
  */
 protected static function deleteTestVocabulary()
 {
     taxonomy_vocabulary_delete(self::$vocabulary->vid);
 }
<?php

$vocab = taxonomy_vocabulary_machine_name_load('faq_category');
taxonomy_vocabulary_delete($vocab->vid);