0

I've created all necessary yaml files to create new vocabulary, i am putting them to /config/install folder and new vocab is created after I reinstall module. How can I create vocabulary by updating modules?

I managed to create vocabulary by adding, code below, but it has no fields I put in yaml files

function module_update_8805() {
    $config_path = 'modules/feature/module/config/new_vocab/';
    $source = new FileStorage($config_path);

    \Drupal::entityManager()->getStorage('taxonomy_vocabulary')
        ->create($source->read('taxonomy.vocabulary.new_vocab'))
        ->save();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.