Ejemplo n.º 1
0
 public function getModal()
 {
     if (self::$_modal === null) {
         ob_start();
         ob_implicit_flush(false);
         $this->optionsModal['class'] = Modal::className();
         self::$_modal = Yii::createObject($this->optionsModal);
         $out = self::$_modal->run();
         $out = ob_get_clean() . $out;
         $view = $this->getView();
         $view->on($view::EVENT_END_BODY, function () use($out) {
             echo $out;
         });
     }
     return self::$_modal;
 }
Ejemplo n.º 2
0
 /**
  * Initializes the widget.
  * This method will register the bootstrap asset bundle. If you override this method,
  * make sure you call the parent implementation first.
  */
 public function init()
 {
     parent::init();
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (!isset($this->element) || $this->element === false) {
         $this->element = 'document.body';
     }
     //Prepare modal dialog
     ob_start();
     ob_implicit_flush(false);
     $this->_modal = \Yii::createObject(['class' => Modal::className(), 'header' => '<h4 class="modal-title">Карта</h4>', 'size' => Modal::SIZE_DEFAULT, 'toggleButton' => false, 'footer' => '<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>']);
     $this->_modal->run();
     $this->_modalHtml = ob_get_clean();
 }