
Subscribe: RSS
  • Based on what I’ve found in the forums or reading the docs it seems like you should be able to set a different media source for each context:


    This works perfectly with template variables but in the main rich text editor window if you add an image (or link) the resource browser loads the directory that is associated with the “default_media_source” in the main “System Settings” (it ignores the context setting). I’ve tested this with both CKEditor and TinyMCE and neither work.

    The URL that is called for the resource browser popup looks like this:


    So the “source” media id is being recognized correctly (source=3) but this isn’t being passed to the directory listing script:

    /connectors/browser/directory.php?action=getList&id=/ (POST value has source=1)

    After some digging and experimenting with the source code I think that both editors are using an old URL parameter. If you call the resource browser with the following the context media source loads correctly:


    So as a fix I made the following changes:



    Line 207 change to

    filebrowserBrowseUrl: MODx.config['manager_url'] + 'index.php?a=' + MODx.action['browser'] + '&source=' + MODx.config['default_media_source'] + '&ctx=' + MODx.config['wctx'], // TODO !!!

    MODX 2.2.10 core files


    Line 53 change to:

    'resource_classes' => $resourceClasses,
    'wctx' => $workingContext->get('key'),

    The only issue with these changes is that they will break once MODX is updated (I'm guessing the "&source=" URL parameter used to work but was recently deprecated?).
    • Thanks for posting this. It might explain an issue I recently posted about in the 'bugs' forum.

      I created a new media source, and thereafter all thumbnails, both in the manager (i.e. for media type TVs) and resource browser were broken.

      In addition, when I used the resource browser in the new context, which was configured to look directly into /assets/images/, I didn't see thumbnails at all.

      I did not [think to] check the source, but do you think based on what you found that this was the issue? If so I'll try editing the code as described in your post.