You are here

function datatables_library in DataTables 7

Same name and namespace in other branches
  1. 7.2 datatables.module \datatables_library()

Implements hook_library().

File

./datatables.module, line 27
Provides integration of the jQuery DataTables plugin

Code

function datatables_library() {
  $libraries = array();
  $lib_path = _datatables_get_path();

  // Make sure we have a valid library path before returning library load info.
  if (!empty($lib_path)) {
    $libraries['datatables'] = array(
      'title' => 'DataTables',
      'website' => 'http://http://datatables.net/',
      'version' => '1.9',
      'js' => array(
        $lib_path . '/media/js/jquery.dataTables.js' => array(),
        drupal_get_path('module', 'datatables') . '/js/datatables.js' => array(),
      ),
      'css' => array(
        $lib_path . '/media/css/demo_table.css' => array(),
      ),
    );
    $libraries['datatables-tabletools'] = array(
      'title' => 'Tabletools plugin for DataTables',
      'website' => 'http://www.datatables.net/extras/tabletools/',
      'version' => '1.1.4',
      'js' => array(
        $lib_path . '/extras/TableTools/media/js/ZeroClipboard.js' => array(),
        $lib_path . '/extras/TableTools/media/js/TableTools.js' => array(),
      ),
      'css' => array(
        $lib_path . '/extras/TableTools/media/css/TableTools.css' => array(),
      ),
      'dependencies' => array(
        array(
          'datatables',
          'datatables',
        ),
      ),
    );
  }
  return $libraries;
}