You are here

function superfish_styles in Superfish 6

Same name and namespace in other branches
  1. 7 superfish.module \superfish_styles()

Get a list of CSS files that can be used for styles.

2 calls to superfish_styles()
superfish_block in ./superfish.module
Implements hook_block().
superfish_block_validate in ./superfish.module
Validation function for the block configuration form.

File

./superfish.module, line 1274
Enables the use of jQuery Superfish plugin for Drupal menus.

Code

function superfish_styles($display = 'list', $style = NULL) {
  $output = '';
  $directory = superfish_get_path('superfish') . '/style';
  $files = file_exists($directory) ? file_scan_directory($directory, '\\.css$', array(
    '.',
    '..',
  ), 0, TRUE, 'name') : '';
  if ($display == 'list') {
    $output = array(
      'none' => '- ' . t('None') . ' -',
    );
    if (is_array($files)) {
      foreach ($files as $file) {
        $output[$file->name] = drupal_ucfirst($file->name);
      }
    }
    natcasesort($output);
  }
  if ($display == 'path' && $style) {
    if (isset($files[$style])) {
      $output = $files[$style]->filename;
    }
    else {
      watchdog('page not found', 'Cannot find the required files for the Superfish \'%style\' style.', array(
        '%style' => $style,
      ), WATCHDOG_WARNING);
      $output = '';
    }
  }
  return $output;
}