You are here

function _pdb_library_build_get_assets in Decoupled Blocks 8

Helper function to process and build library assets.

2 calls to _pdb_library_build_get_assets()
_pdb_library_build_css in ./pdb.module
Helper function to process and build library css assets.
_pdb_library_build_js in ./pdb.module
Helper function to process and build library js assets.

File

./pdb.module, line 143
PDB Module.

Code

function _pdb_library_build_get_assets($assets, $path, $group = FALSE) {
  $processed = [];
  foreach ($assets as $asset_file => $asset_data) {

    // Allow external assets to use absolute path.
    if (!empty($asset_data['type']) && $asset_data['type'] == 'external') {
      $asset_path = $asset_file;
    }
    else {
      $asset_path = '/' . $path . '/' . $asset_file;
    }
    $processed[$asset_path] = $asset_data;
  }

  // Add a group parent if there is one.
  if ($group) {
    $processed = [
      $group => $processed,
    ];
  }
  return $processed;
}