You are here

function dnd_library in Scald: Media Management made easy 7

Implements hook_library().

1 string reference to 'dnd_library'
scald_dnd_library_views_default_views in modules/library/scald_dnd_library/includes/scald_dnd_library.views_default.inc
Implements hook_views_default_views().

File

modules/library/dnd/dnd.module, line 93

Code

function dnd_library() {
  $path = drupal_get_path('module', 'dnd');
  $contexts = dnd_scald_wysiwyg_context_list();
  $config = array();
  foreach (dnd_scald_wysiwyg_context_slugs() as $slug) {
    $config[$slug] = scald_context_config_load($slug);
  }
  $qtip_settings = '';
  if (function_exists('qtip_fetch_instances_field')) {
    $instance = variable_get('dnd_qtip_instance', '');
    if (!empty($instance)) {
      $qtip_settings = qtip_clean_settings(qtip_load($instance));
    }
  }
  $libraries['library'] = array(
    'title' => 'DnD Library',
    'website' => 'http://drupal.org/project/scald',
    'version' => '1.x',
    'dependencies' => array(
      array(
        'system',
        'jquery.form',
      ),
    ),
    'js' => array(
      // Drag and drop
      $path . '/js/dnd-library.js' => array(),
      // Javascript workaround for the continue button.
      $path . '/js/dnd-modal.js' => array(),
      // Settings for the library url.
      array(
        'type' => 'setting',
        'data' => array(
          'dnd' => array(
            'url' => url(dnd_get_library()),
            'contexts' => $contexts,
            'contextDefault' => variable_get('dnd_context_default', 'sdl_editor_representation'),
            'usesCaptionDefault' => variable_get('dnd_uses_caption_default', TRUE),
            'contexts_config' => $config,
            'qTipSettings' => $qtip_settings,
          ),
        ),
      ),
    ),
    'css' => array(
      // Contains the library theming.
      $path . '/css/dnd-library.css' => array(
        'type' => 'file',
        'media' => 'screen',
      ),
    ),
  );

  // Add the qTip library as a dependency if it exists.
  if (function_exists('qtip_library')) {
    $libraries['library']['dependencies'][] = array(
      'qtip',
      'qtip',
    );
  }

  // Libraries might provide atom quick add links. We add CTools Modal JS so
  // that libraries can take use of it if they want.
  dnd_library_add_ctools_modal($libraries);
  $libraries['library']['dependencies'][] = array(
    'dnd',
    'ctools.modal',
  );
  return $libraries;
}