Media 2.x includes admin UI to enable/disable media browser plugins (Upload/Web/Library/etc). This is usually configured at the field level, but there is a working patch over at #1434118: Make a Separate Config for WYSIWYG's Media Browser - see #17 and #28 to add an instance of the config form for the WYSIWYG editor plugin. It would be very useful to have this working for the CKEditor module as well. Assuming this patch is accepted by media's maintainers, is there a way to get the ckeditor module to pull the config from the wysiwyg_browser_plugins variable and use it for the ckeditor plugin as well?

I've been trying to find a way to do this myself but am a little stumped so far.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkesicki’s picture

Status: Active » Postponed

@dafeder,
thank you for information. We try check this in future. Please be patient.

dafeder’s picture

No problem. Happy to help if I can, let me know. I think this could actually be accomplished without having to submit a patch to the media module; the extra config options could just be added to the media settings form with a form_alter.

steveaylwin’s picture

Has there been any progress on this? We abandoned WYSIWYG + CKEditor library because of a cursor bug that required upgrade to v4 of CKEditor, and this was incompatible with that version of WYSI - we have since spent a lot of time integrating the standalone CKEditor module, which now means we don't have UI control of the media browser tabs (although new tabs can be added through media browser views). Obviously this could be done programmatically, but a UI option for enabling media browser tabs would be very useful.

renatovargas’s picture

From inside CKEditor, we could use the code below. In the hook_form_FORM_ID_alter, we need to change the access of the WYSIWYG configuration to bypass "module_exists('wysiwyg')" test. In the hook_media_browser_params_alter, we load the parameters when a media browser is opened. The "allowed types" filter doesn't seem to work, but I think it's a Media's issue.

/**
 * Implements hook_form_FORM_ID_alter() for media_admin_config_browser().
 */
function ckeditor_form_media_admin_config_browser_alter(&$form, &$form_state) {
  $form['wysiwyg']['#access'] = TRUE;
}

/**
 * Implements hook_media_browser_params_alter().
 */
function ckeditor_media_browser_params_alter(&$stored_params) {
  $stored_params['enabledPlugins'] = variable_get('media__wysiwyg_browser_plugins', array());
  $stored_params['file_directory'] = variable_get('media__wysiwyg_upload_directory', '');
  $stored_params['types'] = variable_get('media__wysiwyg_allowed_types', array('audio', 'image', 'video', 'document'));
}

I didn't create a patch because I don't know if it's best to do this inside CKEditor or give support inside Media. There's already a Media's issue for the latter #1988792: Separate Config for CKEditor's Media Browser.
Someone that needs this configuration can use these hooks inside a custom module until one of the modules adds support to it.

aschmoe’s picture

In case anyone wants the patch mentioned in #4.

aschmoe’s picture

aschmoe’s picture

Forgot to "control H" my own module name out of that patch, sorry! :)

j3ll3nl’s picture

Thnx for this. Fixed it for me.

kevinchampion’s picture

Recent changes and refactoring in media, particular with regards to wysiwyg integration, changed these variable names from :

media__wysiwyg_browser_plugins
media__wysiwyg_upload_directory
media__wysiwyg_allowed_types

to:

media_wysiwyg_wysiwyg_browser_plugins
media_wysiwyg_wysiwyg_upload_directory
media_wysiwyg_wysiwyg_allowed_types

Patch rerolled.

drclaw’s picture

For anyone who has switched over to using the media_wysiwyg sub-module of media-7.x-2.x for ckeditor support, this issue might be of help? #2333855: Media Browser Settings for "WYSIWYG" aren't respected with CKEditor Module (e.g. browser tabs)

Tess Bakker’s picture

Status: Postponed » Needs review
FileSize
1.23 KB

Hi,

Patch #9 works with the media-7.x-2.x-alpha3+114-dev, only it doesn't work when you use ckeditor with media and a file field with media on the same page.

The new patch will check for missing variables, that's always in the case of CKEditor.

shortspoken’s picture

Thanks @Tessa Bakker!
Patch #11 fixed it for me.

Media: 7.x-2.0-alpha4+26-dev
CKEditor: 7.x-1.16

junaidpv’s picture

Thanks! Patch #11 worked for me too

Media - 7.x-2.0-alpha3+98-dev
CKEditor - 7.x-1.16

jcisio’s picture

Status: Needs review » Closed (won't fix)

Media integration has been removed.