1.20.x bootstrap.inc silkscreen_find_backends($backend_type)

Scan the drivers directories for driver modules and load the class files for the type of backend requested. The supported types are 'config', 'cache', and 'database'.

Parameters

string $backend_type The type of backend to load.:

Return value

List of driver classes:

File

includes/bootstrap.inc, line 1551
Functions that need to be loaded on every Backdrop request.

Code

function silkscreen_find_backends($backend_type) {
  static $driver_classes = array();

  if (!array_key_exists($backend_type, $driver_classes)) {
    $driver_classes[$backend_type] = array();

    $info_files = silkscreen_driver_list();
    foreach ($info_files as $driver_name => $driver_info) {
      $module_path = dirname($driver_info->uri);
      if (array_key_exists($backend_type . '_backend', $driver_info->info)) {
        foreach ($driver_info->info[$backend_type . '_backend'] as $class => $filename) {
          $driver_classes[$backend_type][$class] = BACKDROP_ROOT . '/' . $module_path . '/' . $filename;
        }
      }
    }
  }

  return $driver_classes[$backend_type];
}