Yii Framework Forum: Registerscriptfile With Custom Htmloptions. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Registerscriptfile With Custom Htmloptions. See Dropbox Chooser API to see why it is needed ;-) Rate Topic: -----

#1 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 26 November 2012 - 12:34 PM

Hi. I'm trying to create a widget encapsulating the new Dropbox Chooser API, which need to be included with a tag like this one:

<script type="text/javascript" src="https://www.dropbox.com/static/api/1/dropbox.js" id="dropboxjs" data-app-key="YOUR_APP_KEY"></script>


As you can see, there's a non standard attribute data-app-key in it. So, this Javascript library can not be inserted using registerScriptFile, since the render generates a fixed <script> tag. Of course I can just drop a CHtml::tag('script' blahblah) but this can not be included at the <head> section of the page and there's no way to control if you already included a library in case the widget is used elsewhere in the page (of course I could use a singleton or something else, but it would be cumbersome).

So, something like this would be useful:

public CClientScript registerScriptFile(string $url, integer $position=NULL, array $htmlOptions=NULL)


Notice the new $htmlOptions parameter. I know this means to modify almost 50% of Yii's core classes, but given the strange tendency of "cloud" providers of including weird ways to use their APIs, it is needed, IMO.

Please take it in consideration.
Ah! on-off, simplement!
0

#2 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 26 November 2012 - 12:40 PM

Opened an issue here: https://github.com/y...yii/issues/1761
Ah! on-off, simplement!
0

#3 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 26 November 2012 - 12:46 PM

And BTW, I guess extending just CClientScript is not enough for this case, since rendering is done elsewhere.
Ah! on-off, simplement!
0

#4 User is offline   Zoothcota 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-November 12

Posted 26 November 2012 - 02:38 PM

Спасибо за труды :)))))
0

#5 User is offline   MetaYii 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 393
  • Joined: 07-October 08
  • Location:The Matrix

Posted 26 November 2012 - 07:13 PM

Ok, the attached modifications seem to keep backwards compatibility, I will be testing the htmlOptions tomorrow :)

Edit: there was a bug in the classes, the ones attached on 2012-11-28 work fine.

Attached File(s)


Ah! on-off, simplement!
0

#6 User is offline   resurtm 

  • Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 83
  • Joined: 19-December 10

Posted 22 March 2013 - 06:06 AM

This feature request has been accepted and implemented: https://github.com/y...yii/issues/1761
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users