You are here

function media_library in D7 Media 7

Same name and namespace in other branches
  1. 7.4 media.module \media_library()
  2. 7.2 media.module \media_library()
  3. 7.3 media.module \media_library()

Implements hook_library().

File

./media.module, line 684
Media API

Code

function media_library() {
  $path = drupal_get_path('module', 'media');
  $info = system_get_info('module', 'media');
  $common = array(
    'website' => 'http://drupal.org/project/media',
    'version' => !empty($info['version']) ? $info['version'] : '7.x-1.x',
  );

  /**
   * Contains libraries common to other media modules.
   */
  $libraries['media_base'] = array(
    'title' => 'Media base',
    'js' => array(
      $path . '/js/media.core.js' => array(
        'group' => JS_LIBRARY,
        'weight' => -5,
      ),
      $path . '/js/util/json2.js' => array(
        'group' => JS_LIBRARY,
      ),
      $path . '/js/util/ba-debug.min.js' => array(
        'group' => JS_LIBRARY,
      ),
    ),
    'css' => array(
      $path . '/css/media.css',
    ),
  );

  /**
   * Includes resources needed to launch the media browser.  Should be included
   * on pages where the media browser needs to be launched from.
   */
  $libraries['media_browser'] = array(
    'title' => 'Media Browser popup libraries',
    'js' => array(
      $path . '/js/media.popups.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'media',
        'media_base',
      ),
      array(
        'system',
        'ui.resizable',
      ),
      array(
        'system',
        'ui.draggable',
      ),
      array(
        'system',
        'ui.dialog',
      ),
    ),
  );

  /**
   * Resources needed in the media browser itself.
   */
  $libraries['media_browser_page'] = array(
    'title' => 'Media browser',
    'js' => array(
      $path . '/js/media.browser.js' => array(
        'group' => JS_DEFAULT,
      ),
    ),
    'css' => array(
      $path . '/css/media.browser.css' => array(
        'group' => CSS_DEFAULT,
      ),
    ),
    'dependencies' => array(
      array(
        'media',
        'media_base',
      ),
      array(
        'system',
        'ui.tabs',
      ),
      array(
        'system',
        'ui.draggable',
      ),
      array(
        'system',
        'ui.dialog',
      ),
    ),
  );
  foreach ($libraries as &$library) {
    $library += $common;
  }
  return $libraries;
}