You are here

function sassy_foundation_sassy_resolve_path_foundation in Sassy 7.2

Same name and namespace in other branches
  1. 7.3 sassy_foundation/sassy_foundation.module \sassy_foundation_sassy_resolve_path_foundation()

Implementation hook_sassy_resolve_path_NAMESPACE().

File

extensions/foundation/sassy_foundation.module, line 6

Code

function sassy_foundation_sassy_resolve_path_foundation($filename) {
  if (substr($filename, 0, 7) == 'images/') {
    return drupal_get_path('module', 'sassy_foundation') . '/foundation/' . $filename;
  }
  $path = drupal_get_path('module', 'sassy_foundation') . '/foundation/stylesheets/';
  $filename = str_replace(array(
    '.scss',
    '.sass',
    '.css',
  ), '', trim($filename, ' /._'));
  $files = array(
    'shared/_settings',
    'shared/_colors',
    'shared/_mixins',
    '_buttons',
    '_forms',
    '_globals',
    '_grid',
    '_mobile',
    '_orbit',
    '_reveal',
    '_typography',
    '_ui',
  );

  # if asking for all of foundation, return corrected filenames
  if (!$filename || $filename == '*' || $filename == 'foundation') {
    foreach ($files as $k => $file) {
      $files[$k] = $path . $file . '.sass';
    }
    return $files;
  }

  # otherwise check that it's a corrected file.
  if (in_array($filename, $files)) {
    return url($path . $filename . '.sass');
  }

  // TODO: fix the bug that causes $available to be undefined.
  // Set $available and have it return an empty string.
  $available = '';
  drupal_set_message(t('Unrecognised stylesheet "@file" requested. Available files are: @list', array(
    '@list' => implode(', ', $files),
    '@file' => $filename,
  )), 'error');
  return FALSE;
}