You are here

function quickedit_library in Quick Edit 7

Implements hook_library().

File

./quickedit.module, line 210
Provides in-place content editing functionality for fields.

Code

function quickedit_library() {
  $path = drupal_get_path('module', 'quickedit');
  $options = array(
    'scope' => 'footer',
  );
  $libraries['quickedit'] = array(
    'title' => 'Quick Edit: in-place editing',
    'website' => 'http://drupal.org/project/quickedit',
    'version' => VERSION,
    'js' => array(
      // Core.
      $path . '/js/quickedit.js' => $options,
      $path . '/js/util.js' => $options,
      // Models.
      $path . '/js/models/BaseModel.js' => $options,
      $path . '/js/models/AppModel.js' => $options,
      $path . '/js/models/EntityModel.js' => $options,
      $path . '/js/models/FieldModel.js' => $options,
      $path . '/js/models/EditorModel.js' => $options,
      // Views.
      $path . '/js/views/AppView.js' => $options,
      $path . '/js/views/FieldDecorationView.js' => $options,
      $path . '/js/views/EntityDecorationView.js' => $options,
      $path . '/js/views/EntityToolbarView.js' => $options,
      $path . '/js/views/ContextualLinkView.js' => $options,
      $path . '/js/views/FieldToolbarView.js' => $options,
      $path . '/js/views/EditorView.js' => $options,
      $path . '/js/views/ModalView.js' => $options,
      // Other.
      $path . '/js/theme.js' => $options,
      // Monkey-patch in jQuery UI 1.10 Position at $.fn.position_quickedit.
      $path . '/js/jquery/ducktape.position.js' => $options,
      // Basic settings.
      array(
        'data' => array(
          'quickedit' => array(
            'metadataURL' => url('quickedit/metadata'),
            'attachmentsURL' => url('quickedit/attachments'),
            'fieldFormURL' => url('quickedit/form/!entity_type/!id/!field_name/!langcode/!view_mode'),
            'entitySaveURL' => url('quickedit/entity/!entity_type/!id'),
            'rerenderProcessedTextURL' => url('quickedit/text/!entity_type/!id/!field_name/!langcode/!view_mode'),
            'context' => 'body',
          ),
        ),
        'type' => 'setting',
      ),
    ),
    'css' => array(
      $path . '/css/contextual-zindex-fix-1102156.css' => array(),
      $path . '/css/quickedit.module.css' => array(),
      $path . '/css/quickedit.theme.css' => array(),
      $path . '/css/quickedit.icons.css' => array(),
    ),
    'dependencies' => array(
      array(
        'system',
        'jquery',
      ),
      array(
        'system',
        'jquery.once',
      ),
      array(
        'quickedit',
        'underscore',
      ),
      array(
        'quickedit',
        'backbone',
      ),
      array(
        'system',
        'jquery.form',
      ),
      array(
        'system',
        'ui.position',
      ),
      array(
        'system',
        'drupal.form',
      ),
      array(
        'system',
        'drupal.ajax',
      ),
    ),
  );
  $libraries['quickedit.inPlaceEditor.form'] = array(
    'title' => 'Form in-place editor',
    'version' => VERSION,
    'js' => array(
      $path . '/js/editors/formEditor.js' => $options,
    ),
    'dependencies' => array(
      array(
        'quickedit',
        'quickedit',
      ),
    ),
  );
  $libraries['quickedit.inPlaceEditor.plainText'] = array(
    'title' => 'Plain text in-place editor',
    'version' => VERSION,
    'js' => array(
      $path . '/js/editors/plainTextEditor.js' => $options,
    ),
    'dependencies' => array(
      array(
        'quickedit',
        'quickedit',
      ),
    ),
  );
  if (module_exists('ckeditor')) {
    $libraries['quickedit.inPlaceEditor.ckeditor'] = array(
      'title' => 'CKEditor formatted text in-place editor',
      'version' => VERSION,
      'js' => array(
        $path . '/js/editors/formattedTextEditor.js' => array(
          'weight' => 3,
        ) + $options,
        array(
          'type' => 'setting',
          'data' => array(
            'quickedit' => array(
              'ckeditor' => array(
                'getUntransformedTextURL' => url('quickedit/ckeditor/!entity_type/!id/!field_name/!langcode/!view_mode'),
              ),
            ),
          ),
        ),
        // CKEditor.module sadly does not implement hook_library(), so we must
        // indicate here that we want it to be loaded.
        ckeditor_library_path('url') . '/ckeditor/ckeditor.js' => array(
          'weight' => 4,
        ) + $options,
      ),
      'dependencies' => array(
        array(
          'quickedit',
          'quickedit',
        ),
        array(
          'system',
          'drupal.ajax',
        ),
      ),
    );
  }
  module_load_include('inc', 'quickedit', 'includes/libraries');
  $libraries['underscore'] = _quickedit_convert_libraries_to_library(libraries_detect('underscore'), array(
    'group' => JS_LIBRARY,
    'weight' => -20,
  ));
  $libraries['backbone'] = _quickedit_convert_libraries_to_library(libraries_detect('backbone'), array(
    'group' => JS_LIBRARY,
    'weight' => -19,
  ));
  return $libraries;
}