Skip to content

Commit

Permalink
modal title from attr
Browse files Browse the repository at this point in the history
  • Loading branch information
loveorigami committed Dec 7, 2016
1 parent cf7af3f commit 5de4aa2
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/ModalAjax.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use yii\base\InvalidConfigException;
use yii\bootstrap\Modal;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\View;

Expand Down Expand Up @@ -52,6 +53,24 @@ class ModalAjax extends Modal
*/
protected $mode = self::MODE_SINGLE;

/**
* Renders the header HTML markup of the modal
* @return string the rendering result
*/
protected function renderHeader()
{
$button = $this->renderCloseButton();
if ($button !== null) {
$this->header = $button . "\n<span>" . $this->header."</span>\n";
}
if ($this->header !== null) {
Html::addCssClass($this->headerOptions, ['widget' => 'modal-header']);
return Html::tag('div', "\n" . $this->header . "\n", $this->headerOptions);
} else {
return null;
}
}

/**
* @inheritdocs
*/
Expand Down Expand Up @@ -122,9 +141,11 @@ protected function registerMultyModal($id, $view)
$(this).attr('data-target', '#$id');
var bs_url = $(this).attr('href');
var title = $(this).attr('title');
if (!title) title = ' ';
//var bs_title = $(this).attr('title');
//jQuery('#$id').find('.modal-header').html(bs_title);
jQuery('#$id').find('.modal-header span').html(title);
jQuery('#$id').kbModalAjax({
url: bs_url,
Expand Down

0 comments on commit 5de4aa2

Please sign in to comment.