You are here

function linkit_library in Linkit 7.3

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

Implements hook_library().

File

./linkit.module, line 389
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.3',
  );

  // Linkit base
  $libraries['base'] = array(
    'title' => 'Linkit base',
    'js' => array(
      $path . '/js/linkit.js' => array(
        'group' => JS_DEFAULT,
        'weight' => -1,
      ),
      // Add global settings for Linkit.
      array(
        'type' => 'setting',
        // ___profile___ is just a placeholder.
        'data' => array(
          'linkit' => array(
            'autocompletePath' => url('linkit/autocomplete/___profile___', array(
              'query' => array(
                LINKIT_BAC_QUERY_KEY => '',
              ),
              'absolute' => TRUE,
            )),
            'dashboardPath' => url('linkit/dashboard/'),
            'currentInstance' => new stdClass(),
          ),
        ),
      ),
    ),
    'dependencies' => array(
      array(
        'system',
        'ui.dialog',
      ),
      array(
        'system',
        'drupal.ajax',
      ),
      array(
        'linkit',
        'dashboard',
      ),
      array(
        'linkit',
        'bac',
      ),
    ),
  );

  // Linkit dashboard.
  $libraries['dashboard'] = array(
    'title' => 'Linkit dashboard',
    'js' => array(
      $path . '/js/linkit.dashboard.js' => array(
        'group' => JS_DEFAULT,
        'weight' => 0,
      ),
    ),
  );

  // Linkit field ui script.
  $libraries['field'] = array(
    'title' => 'Linkit Field UI',
    'js' => array(
      $path . '/js/linkit.field.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'linkit',
        'base',
      ),
    ),
  );

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

  // Linkit tinymce dialog script.
  $libraries['tinymce'] = array(
    'title' => 'Linkit TinyMCE',
    'js' => array(
      $path . '/editors/tinymce/linkitDialog.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'linkit',
        'base',
      ),
    ),
  );
  foreach ($libraries as &$library) {
    $library += $common;
  }

  // Linkit BAC
  $libraries['bac'] = array(
    'website' => 'https://github.com/betamos/Better-Autocomplete',
    'version' => '1.0',
    'title' => 'Better autocomplete',
    'js' => array(
      $path . '/better-autocomplete/jquery.better-autocomplete.js' => array(
        'group' => JS_LIBRARY,
      ),
    ),
    'css' => array(
      $path . '/better-autocomplete/better-autocomplete.css' => array(
        'group' => CSS_DEFAULT,
        'preprocess' => FALSE,
      ),
    ),
  );
  return $libraries;
}