Hello Cooks
For those of us who have a great distaste for serving up their modal views with scrolls, here is a quick fix. Please note that you shouldn't be squeamish about jdom if you want to attempt this update.
Usage: <?php echo JDom::_('html.fly.file', array(
.
.
.
'modal_height' => 400,
'modal_width' => 600,
'scroll_options' => 'no',
.
.
));?>
First we will edit
/dom/html.phpclass JDomHtml extends JDom
{
.
.
.
protected $scroll_options;
function __construct($args)
{
.
.
.
$this->arg('scroll_options', null, $args);
.
}
protected function embedLink($html)
{
.
.
.
if ((isset($this->href) || isset($this->target) || isset($this->task)) && (isset($this->dataValue)) && (!empty($this->dataValue)))
{
.
.
.
$html = JDom::_("html.link", array(
.
.
.
'scroll_options' => (isset($this->scroll_options)?$this->scroll_options:null),
));
}
return $html;
}
}
Next we edit
/dom/html/link.phpclass JDomHtmlLink extends JDomHtml
{
.
.
.
protected $scroll_options;
function __construct($args)
{
.
.
.
$this->arg('scroll_options' , null, $args);
}
.
.
.
function modalLink()
{
JHTML::_('behavior.modal');
$this->addClass('modal');
$rel = "{";
$rel.= "handler: '" . ($this->handler?$this->handler:'') . "'";
if ($this->modal_width && $this->modal_height)
{
$rel .= ", size: {x: " . ((int)$this->modal_width?(int)$this->modal_width:"null")
. ", y: " . ((int)$this->modal_height?(int)$this->modal_height:"null")
. "}";
}
if ($this->scroll_options)
{
$options = array("auto", "no", "yes");
if (!in_array(strtolower($this->scroll_options), $options))
$this->scroll_options = "auto";
$rel .= ", iframeOptions: {scrolling:'" . $this->scroll_options
. "'}";
}
$rel.= "}";
$this->addSelector('rel', $rel);
}
}
And that's all to it.
Now you can turn off the scrollbars on selected modal views anywhere in your j-cook component.
Hope this helps someone coding in this area.
Regards
v