You are here

function linkit_library in Linkit 7.2

Same name and namespace in other branches
  1. 7.3 linkit.module \linkit_library()

Implements hook_library().

File

./linkit.module, line 167
Main file for linkit module.

Code

function linkit_library() {
  $path = drupal_get_path('module', 'linkit');
  $common = array(
    'website' => 'http://drupal.org/project/linkit',
    'version' => '7.2',
  );

  // Better Autocomplete
  $libraries['linkit_bac'] = array(
    'title' => 'Linkit Better Autocomplete',
    'js' => array(
      $path . '/better-autocomplete/jquery.better-autocomplete.js' => array(
        'group' => JS_LIBRARY,
      ),
      array(
        'type' => 'setting',
        'data' => array(
          'linkit' => array(
            'autocompletePath' => url('linkit/autocomplete', array(
              'query' => array(
                's' => '',
              ),
              'absolute' => TRUE,
            )),
          ),
        ),
      ),
    ),
    'css' => array(
      $path . '/better-autocomplete/better-autocomplete.css' => array(
        'group' => CSS_DEFAULT,
      ),
    ),
  );

  // Linkit base
  $libraries['linkit_base'] = array(
    'title' => 'Linkit base',
    'js' => array(
      $path . '/js/linkit.js' => array(
        'group' => JS_DEFAULT,
      ),
      $path . '/js/linkit.dialog.js' => array(
        'group' => JS_DEFAULT,
      ),
      // Add global settings for Linkit
      array(
        'type' => 'setting',
        'data' => array(
          'linkit' => array(
            'modulepath' => drupal_get_path('module', 'linkit'),
          ),
        ),
      ),
    ),
    'css' => array(
      $path . '/css/linkit.css' => array(
        'group' => CSS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'system',
        'ui.dialog',
      ),
      array(
        'system',
        'drupal.collapse',
      ),
      array(
        'linkit',
        'linkit_bac',
      ),
    ),
  );

  // Linkit ckeditor dialog script.
  $libraries['linkit_ckeditor'] = array(
    'title' => 'Linkit CKeditor',
    'js' => array(
      $path . '/editors/ckeditor/linkitDialog.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
  );

  // Linkit tinymce dialog script.
  $libraries['linkit_tinymce'] = array(
    'title' => 'Linkit TinyMCE',
    'js' => array(
      $path . '/editors/tinymce/linkitDialog.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
  );

  // Linkit field ui script.
  $libraries['linkit_field'] = array(
    'title' => 'Linkit Field UI',
    'js' => array(
      $path . '/js/linkit.field.js' => array(
        'group' => JS_DEFAULT,
      ),
      $path . '/js/linkitFieldDialog.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'linkit',
        'linkit_base',
      ),
    ),
  );
  foreach ($libraries as &$library) {
    $library += $common;
  }
  return $libraries;
}