You are here

function _pdb_library_build_css in Decoupled Blocks 8

Helper function to process and build library css assets.

1 call to _pdb_library_build_css()
pdb_library_info_build in ./pdb.module
Implements hook_library_info_build().

File

./pdb.module, line 76
PDB Module.

Code

function _pdb_library_build_css($info, $path) {
  $css_assets = [];
  if (isset($info['add_css']['header'])) {

    // Supports current simplest method to add css assets to the library.
    if (!isset($info['add_css']['header']['css'])) {

      // This assumes add_css -> header contains the assets.
      $info['add_css']['header'] = [
        'css' => $info['add_css']['header'],
      ];
    }
    foreach ($info['add_css']['header']['css'] as $group => $css) {
      $header_css = _pdb_library_build_get_assets($css, $path, $group);
      $info['add_css']['header']['css'] = $header_css;
      $css_assets['header'] = $info['add_css']['header'];
    }
  }
  if (isset($info['add_css']['footer'])) {
    if (!isset($info['add_css']['footer']['css'])) {

      // This assumes add_css -> footer contains the assets.
      $info['add_css']['footer'] = [
        'css' => $info['add_css']['footer'],
      ];
    }
    foreach ($info['add_css']['footer']['css'] as $group => $css) {
      $footer_css = _pdb_library_build_get_assets($css, $path, $group);
      $info['add_css']['footer']['css'] = $footer_css;
      $css_assets['footer'] = $info['add_css']['footer'];
    }
  }
  return $css_assets;
}