You are here

function biblio_get_styles in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 biblio.module \biblio_get_styles()
  2. 7.2 biblio.module \biblio_get_styles()
4 calls to biblio_get_styles()
biblio_admin_settings in includes/biblio.admin.inc
Implementation of hook_settings().
biblio_citeproc_style_manager_form in modules/CiteProc/biblio_citeproc.admin.inc
biblio_handler_citation::options_form in views/biblio_handler_citation.inc
Default options form provides the label widget that all fields should have.
_biblio_get_user_profile_form in includes/biblio.admin.inc
This functin is used by both the admin/config/content/biblio page and user profile page

File

./biblio.module, line 2382
Bibliography Module for Drupal.

Code

function biblio_get_styles() {
  $styles = array();
  if (module_exists('biblio_citeproc')) {
    $result = db_select('biblio_citeproc_styles', 'csl')
      ->fields('csl', array(
      'filename',
      'title',
    ))
      ->orderBy('title', 'ASC')
      ->execute();
    foreach ($result as $style) {
      $styles[$style->filename] = $style->title;
    }
  }
  else {
    $dir = drupal_get_path('module', 'biblio') . '/styles';
    $files = file_scan_directory($dir, '/biblio_style_..*.inc$/');
    foreach ($files as $file) {
      include_once $file->uri;
      $function = $file->name . '_info';
      if (function_exists($function)) {

        // Build and array of the short and long names.
        $styles = array_merge($styles, call_user_func($function));
      }
    }
    ksort($styles);
  }
  return $styles;
}