You are here

function footable_library in FooTable 7

Implements hook_library().

File

./footable.module, line 10
Provides integration of the jQuery FooTable plugin into Views.

Code

function footable_library() {

  // Locate the FooTables JS library (borrowed from DataTables module).
  $lib_path = NULL;
  $libraries = array();
  if (file_exists(drupal_get_path('module', 'footable') . '/FooTable/js/footable.js')) {
    $lib_path = drupal_get_path('module', 'footable') . '/FooTable';
  }
  elseif (module_exists('libraries') && file_exists(libraries_get_path('FooTable') . '/js/footable.js')) {
    $lib_path = libraries_get_path('FooTable');
  }

  // Make sure we have a valid library path before returning library load info
  if (!empty($lib_path)) {

    // CSS file changed in v2.
    $css_file = file_exists($lib_path . '/css/footable.core.min.css') ? $lib_path . '/css/footable.core.min.css' : $lib_path . '/css/footable-0.1.css';
    $libraries['footable'] = array(
      'title' => 'FooTable',
      'website' => 'http://themergency.com/footable/',
      'version' => '0.1',
      'js' => array(
        $lib_path . '/js/footable.js' => array(),
      ),
      'css' => array(
        $css_file => array(
          'type' => 'file',
          'media' => 'screen',
        ),
      ),
    );
  }
  return $libraries;
}