Browse files

fixed mediaform urls in modeladmin

  • Loading branch information...
1 parent 6882635 commit f0f5dcb966da9123e88dc1f8acc71065cfd7c8d8 @icecaster icecaster committed Nov 9, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 forms/HtmlEditorField.php
4 forms/HtmlEditorField.php
@@ -278,8 +278,8 @@ public function __construct($controller, $name) {
public function forTemplate() {
return sprintf(
'<div id="cms-editor-dialogs" data-url-linkform="%s" data-url-mediaform="%s"></div>',
- Controller::join_links($this->controller->Link($this->name), 'LinkForm', 'forTemplate'),
- Controller::join_links($this->controller->Link($this->name), 'MediaForm', 'forTemplate')
+ Controller::join_links($this->controller->Link(), $this->name, 'LinkForm', 'forTemplate'),
+ Controller::join_links($this->controller->Link(), $this->name, 'MediaForm', 'forTemplate')

3 comments on commit f0f5dcb


Can someone tell me the reason , why it is dynamically generated but does not change in the backend when I click the different menu...... if it does not change in the backend, it can be a static link? Just curious.

SilverStripe Ltd. member

It changes depending on the controller, no?

Just because it's the same whenever it's used in LeftAndMain doesn't mean it doesn't change when used on a frontend controller

SilverStripe Ltd. member

Explained (a little) in

Toolbar shared by all instances of {@link HTMLEditorField}, to avoid too much markup duplication.
Needs to be inserted manually into the template in order to function - see {@link LeftAndMain->EditorToolbar()}.

This is more of a legacy approach taken over from 2.x when we didn't support TinyMCE in ModelAdmin. Its more of a necessity because the toolbar is implemented as a Form instance, which needs some controller attached to it. We should split this out to make HtmlEditorField_Toolbar a standalone controller

Please sign in to comment.