You are here

function migrate_example_wine_categories in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 migrate_example/wine.install.inc \migrate_example_wine_categories()
1 call to migrate_example_wine_categories()
migrate_example_wine_install in migrate_example/wine.install.inc
3 string references to 'migrate_example_wine_categories'
MigrateNodeUnitTest::testNodeImport in tests/plugins/destinations/node.test
MigrateTaxonomyUnitTest::testTermImport in tests/plugins/destinations/term.test
WineWineMigration::__construct in migrate_example/wine.inc
General initialization of a Migration object.

File

migrate_example/wine.install.inc, line 656
Set up for the wine (advanced) example.

Code

function migrate_example_wine_categories() {

  // Create vocabularies for variety, region, and "best with"
  $description = st('Wine varieties');
  $help = st('Select the variety of this wine');
  $vocabulary = array(
    'name' => 'Migrate Example Wine Varieties',
    'description' => $description,
    'machine_name' => 'migrate_example_wine_varieties',
    'help' => $help,
    'multiple' => 1,
    'required' => 0,
    'hierarchy' => 1,
    'relations' => 0,
    'module' => 'migrate_example',
    'nodes' => array(
      'migrate_example_wine' => 1,
    ),
  );
  taxonomy_vocabulary_save($vocabulary);
  $description = st('Wine regions');
  $help = st('Select the region this wine comes from');
  $vocabulary = (object) array(
    'name' => 'Migrate Example Wine Regions',
    'description' => $description,
    'machine_name' => 'migrate_example_wine_regions',
    'help' => $help,
    'multiple' => 0,
    'required' => 0,
    'hierarchy' => 1,
    'relations' => 0,
    'module' => 'migrate_example',
    'nodes' => array(
      'migrate_example_wine' => 1,
      'migrate_example_producer' => 1,
    ),
  );
  taxonomy_vocabulary_save($vocabulary);
  $description = st('Foods the wine goes best with');
  $help = st('Enter any foods this wine may be paired with, separated by commas');
  $vocabulary = (object) array(
    'name' => 'Migrate Example Wine Best With',
    'description' => $description,
    'machine_name' => 'migrate_example_wine_best_with',
    'help' => $help,
    'multiple' => 1,
    'required' => 0,
    'hierarchy' => 0,
    'relations' => 0,
    'module' => 'migrate_example',
    'nodes' => array(
      'migrate_example_wine' => 1,
    ),
  );
  taxonomy_vocabulary_save($vocabulary);
}