You are here

public static function TaxonomiesController::deleteTaxonomies in Structure Sync 8

Same name and namespace in other branches
  1. 2.x src/Controller/TaxonomiesController.php \Drupal\structure_sync\Controller\TaxonomiesController::deleteTaxonomies()

Function to delete all taxonomy terms.

1 call to TaxonomiesController::deleteTaxonomies()
TaxonomiesController::importTaxonomies in src/Controller/TaxonomiesController.php
Function to import taxonomy terms.

File

src/Controller/TaxonomiesController.php, line 669

Class

TaxonomiesController
Controller for syncing taxonomy terms.

Namespace

Drupal\structure_sync\Controller

Code

public static function deleteTaxonomies(&$context) {
  $query = StructureSyncHelper::getEntityQuery('taxonomy_term');
  $tids = $query
    ->execute();
  $controller = StructureSyncHelper::getEntityManager()
    ->getStorage('taxonomy_term');
  $entities = $controller
    ->loadMultiple($tids);
  $controller
    ->delete($entities);
  if (array_key_exists('drush', $context) && $context['drush'] === TRUE) {
    drush_log('Deleted all taxonomies', 'ok');
  }
  StructureSyncHelper::logMessage('Deleted all taxonomies');
}