Commit d7868435 by niskac

added support for setting JS options for BootModal

parent 2aba5d86
......@@ -16,6 +16,10 @@ Yii::import('bootstrap.widgets.BootWidget');
class BootModal extends CWidget
{
/**
* @var boolean whether to automatically open the modal when initialized.
*/
public $autoOpen = false;
/**
* @var array the options for the Bootstrap JavaScript plugin.
*/
public $options = array();
......@@ -35,6 +39,9 @@ class BootModal extends CWidget
{
parent::init();
if (!$this->autoOpen && !isset($this->options['show']))
$this->options['show'] = false;
if (!isset($this->htmlOptions['id']))
$this->htmlOptions['id'] = $this->getId();
......@@ -59,6 +66,9 @@ class BootModal extends CWidget
/** @var CClientScript $cs */
$cs = Yii::app()->getClientScript();
$options = CJavaScript::encode($this->options);
$cs->registerScript(__CLASS__.'#'.$id, "jQuery('#{$id}').modal({$options});");
// Register the "show" event-handler.
if (isset($this->events['show']))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment