[Solar-talk] agnostic js helper
Rodrigo Moraes
rodrigo.moraes at gmail.com
Tue Dec 5 15:11:55 PST 2006
Hi again,
The change would be more simple than I thought. I moved part of
js::fetchInline() to JsPrototype::setScripts() and adapted some bits
to access selectors, objects and set scripts. The result is clean and
straightforward:
public function fetchInline()
{
$js = '';
// The library is responsible for setting additional inline
scripts for events and
// specific objects. setScripts() is just a suggested name for
the library method.
$this->_view->getHelper($this->_config['library'])->setScripts();
// Gather all registered scripts for output
if (!empty($this->scripts)) {
$scripts = implode("\n\n", $this->scripts);
$scripts = trim($scripts);
$js = $this->_view->inlineScript($scripts);
}
return $js;
}
It would be convenient to move specific library lines away from the Js
helper; also it adds a hook for any javascript library to set its
scripts on fetch time. Bad idea? Any thoughts?
rodrigo
---------------------------------------------------------------------
Solar has now a Community Wiki: solarphp.org
---------------------------------------------------------------------
Join the #solarphp IRC channel on freenode.org
---------------------------------------------------------------------
More information about the solar-talk
mailing list