If the composer vendor directory is outside DRUPAL_ROOT, the exporter classes are no longer listed because the path is not correct.

=> see function "getExporters()" (https://cgit.drupalcode.org/loft_data_grids/tree/src/LoftDataGrids.php?h=8.x-1.x)

In this function the path is defined more or less statically:

=> $path = DRUPAL_ROOT . '/vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/';

If I now install Drupal with the composer plugin "drupal-paranoia", this path is no longer correct.

Is there a way to dynamically determine the vendor directory via Drupal, or does it make sense to move the vendor directory path specification to a settings variable?

Like, for example: $settings['vendor_file_path'] = 'path/to/vendor/folder'; in settings.php

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

medienverbinder created an issue. See original summary.

edysmp’s picture

Status: Active » Needs review
FileSize
712 bytes

This can be done using ReflectionClass.

medienverbinder’s picture

Great! The patch works for me.

To prevent a WSOD, I would suggest to put the ReflectionClass call in a try, catch block, and display a message if a path error occurs. (Drupal\Core\Messenger\MessengerTrait)