33
33
class RenderSettings
34
34
{
35
35
/**
36
- * Return the link picker wizard.
36
+ * Return the link picker wizard - this is called from Multi column wizard in render settings jumpTo page handling.
37
+ *
38
+ * We should change this callback to event handlers as soon as MCW understands how DcGeneral events work.
39
+ * So far MCW does not build sub widgets the MCW way, therefore we need to keep this as it is, despite the fact that
40
+ * we are jumping multiple hoops with the inline javascript code to obtain the value.
37
41
*
38
42
* @param DC_General $dataContainer The DC_General currently in use.
39
43
*
@@ -49,14 +53,6 @@ public function pagePicker(DC_General $dataContainer)
49
53
$ dataContainer ->inputName
50
54
);
51
55
52
- $ options = sprintf (
53
- "{'width':765,'title':'%s','url':'%s','id':'%s','tag':'ctrl_%s','self':this} " ,
54
- $ environment ->getTranslator ()->translate ('MOD.page.0 ' ),
55
- $ url ,
56
- $ dataContainer ->inputName ,
57
- $ dataContainer ->inputName
58
- );
59
-
60
56
$ event = new GenerateHtmlEvent (
61
57
'pickpage.gif ' ,
62
58
$ environment ->getTranslator ()->translate ('MSC.pagepicker ' ),
@@ -66,9 +62,16 @@ public function pagePicker(DC_General $dataContainer)
66
62
$ environment ->getEventDispatcher ()->dispatch (ContaoEvents::IMAGE_GET_HTML , $ event );
67
63
68
64
return sprintf (
69
- ' <a href="%s"%s>%s</a> ' ,
65
+ ' <a href="%1$s" onclick="Backend.openModalSelector( ' .
66
+ '{ \'width \':765, ' .
67
+ '\'title \': \'%2$s \', ' .
68
+ '\'url \': this.href + \'&value= \' + ' .
69
+ // We have no access to the current value as MCW does not understand DCG so far. So we do it all in JS.
70
+ '/{{link_url::([^}]*)}}/.exec($( \'ctrl_%3$s \').value)[1], \'id \': \'ctrl_%3$s \'} ' .
71
+ '); return false;">%4$s</a> ' ,
70
72
$ url ,
71
- ' onclick="Backend.openModalSelector( ' . $ options . '); return false;" ' ,
73
+ specialchars (str_replace ('\'' , '\\\'' , $ environment ->getTranslator ()->translate ('MOD.page.0 ' ))),
74
+ $ dataContainer ->inputName ,
72
75
$ event ->getHtml ()
73
76
);
74
77
}
0 commit comments