You are here

function _skinr_fix_path in Skinr 8.2

Helper function to fix library paths for skin plugins.

See also

skinr_library_info_build()

1 call to _skinr_fix_path()
_skinr_attached_to_library in ./skinr.module
Helper function to turn skin plugins attached arrays into a library.

File

./skinr.module, line 117
Handles core Skinr functionality.

Code

function _skinr_fix_path(&$data, $path) {
  $is_local_uri = function ($uri) {
    $scheme = \Drupal::service('file_system')
      ->uriScheme($uri);
    return $scheme === FALSE || \Drupal::service('stream_wrapper_manager')
      ->getViaScheme($scheme) instanceof \Drupal\Core\StreamWrapper\LocalStream;
  };
  $new = [];
  foreach ($data as $source => $options) {
    if ($is_local_uri($source)) {
      $new[$path . $source] = $options;
    }
    else {
      $new[$source] = $options;
    }
  }
  $data = $new;
}