Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using a Drupal 8 install without the Taxonomy module enabled:
- Install the datalayer module
- Navigate to /admin/config/search/datalayer
- Fatal error:
Error: Class 'Drupal\taxonomy\Entity\Vocabulary' not found in Drupal\datalayer\Form\DatalayerSettingsForm->buildForm() (line 128 of modules/contrib/datalayer/src/Form/DatalayerSettingsForm.php).
We should check if the Taxonomy module is enabled, I think this can be done using the following:
// Setup vocabs.
$v_options = [];
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('taxonomy')){
$vocabs = Vocabulary::loadMultiple();
foreach ($vocabs as $v) {
$v_options[$v->id()] = $v->label();
}
}
$datalayer_settings = $this->config('datalayer.settings');
This seemed to work, but I might have missed something.
I'm using 8.x-1.0-beta2, but might also be in other versions.
Issue fork datalayer-3156321
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
Balu ErtlComment #7
eojthebrave