Commit c3cda2b7 authored by unknown's avatar unknown
Browse files

Issue #1504696 by das-peter, kevinchampion, tobby, catch, douggr

een, dafeder, ndobromirov, Devin Carlson, axe312, brantwynn
parent 7d12b8be
Loading
Loading
Loading
Loading
+16 −0
Changes for modules/media_wysiwyg/media_wysiwyg.ckeditor.inc: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Provides WYSIWYG integration for CKEditor.
 */

/**
 * Implements hook_ckeditor_plugin_alter().
 */
function media_wysiwyg_ckeditor_plugin_alter(&$plugins) {
  // Replace the CKEditor media plugin with the Media WYSIWYG media plugin.
  if (isset($plugins['media'])) {
    $plugins['media']['path'] = drupal_get_path('module', 'media_wysiwyg') . '/wysiwyg_plugins/media_ckeditor/';
  }
}
+2 −1
Changes for modules/media_wysiwyg/media_wysiwyg.info: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,9 +4,10 @@ package = Media
core = 7.x

dependencies[] = media
dependencies[] = wysiwyg

test_dependencies[] = ckeditor
test_dependencies[] = token
test_dependencies[] = wysiwyg

files[] = media_wysiwyg.test
files[] = tests/media_wysiwyg.file_usage.test
+29 −0
Changes for modules/media_wysiwyg/media_wysiwyg.module: 29 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -158,6 +158,35 @@ function media_wysiwyg_filter_info() {
  return $filters;
}

/**
 * Prepares the page to be able to launch the media browser.
 *
 * Defines default variables.
 */
function media_wysiwyg_include_browser_js() {
  static $included;
  if ($included) {
    return;
  }
  $included = TRUE;
  module_load_include('inc', 'media', 'includes/media.browser');
  $javascript = media_browser_js();
  foreach ($javascript as $key => $definitions) {
    foreach ($definitions as $definition) {
      $function = 'drupal_add_' . $key;
      // Since the arguments to pass are variable, use call_user_func_array().
      // This will not handle all potential drupal_add_*() functions directly
      // but covers the js and library needed here, which are unlikely to be
      // expanded since this function is only a workaround for a wysiwyg
      // limitation.
      call_user_func_array($function, $definition);
    }
  }
  // Add wysiwyg-specific settings.
  $settings = array('wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()));
  drupal_add_js(array('media' => $settings), 'setting');
}

/**
 * Implements hook_wysiwyg_include_directory().
 */
+2 −31
Changes for modules/media_wysiwyg/wysiwyg_plugins/media.inc: 2 added lines, 31 removed lines.
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ function media_wysiwyg_media_plugin() {
  $plugins['media'] = array(
    'title' => variable_get('media_wysiwyg_wysiwyg_title', t('Media browser')),
    'vendor url' => 'http://drupal.org/project/media',
    'icon path' => drupal_get_path('module', 'media_wysiwyg') . '/images',
    'icon file' => 'wysiwyg-media.gif',
    'icon path' => drupal_get_path('module', 'media_wysiwyg') . '/wysiwyg_plugins/media_ckeditor/images',
    'icon file' => 'icon.gif',
    'icon title' => variable_get('media_wysiwyg_wysiwyg_icon_title', t('Add media')),
    // @todo: move this to the plugin directory for the wysiwyg plugin.
    'js path' => drupal_get_path('module', 'media_wysiwyg') . '/js',
@@ -42,32 +42,3 @@ function media_wysiwyg_media_plugin() {

  return $plugins;
}

/**
 * Prepares the page to be able to launch the media browser.
 *
 * Defines default variables.
 */
function media_wysiwyg_include_browser_js() {
  static $included;
  if ($included) {
    return;
  }
  $included = TRUE;
  module_load_include('inc', 'media', 'includes/media.browser');
  $javascript = media_browser_js();
  foreach ($javascript as $key => $definitions) {
    foreach ($definitions as $definition) {
      $function = 'drupal_add_' . $key;
      // Since the arguments to pass are variable, use call_user_func_array().
      // This will not handle all potential drupal_add_*() functions directly
      // but covers the js and library needed here, which are unlikely to be
      // expanded since this function is only a workaround for a wysiwyg
      // limitation.
      call_user_func_array($function, $definition);
    }
  }
  // Add wysiwyg-specific settings.
  $settings = array('wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()));
  drupal_add_js(array('media' => $settings), 'setting');
}
+126 B
Loading image diff...
Loading