Commit 034d5707 authored by KoJIT2009's avatar KoJIT2009 Committed by Alexander Makarov

Fixes #208: Added `yii\bootstrap\Modal::$bodyOptions` to allow add options to body part Modal

parent e6a20fa7
......@@ -19,6 +19,7 @@ Yii Framework 2 bootstrap extension Change Log
- Bug #162: Fixed `yii\bootstrap\Nav` not taking explicit `active` into account when `activateItems` is off (samdark)
- Enh #174: Added `yii\bootstrap\Tabs::renderPanes()` to allow extending the class to manipulate the content between the tabs and the content (thiagotalma)
- Bug #196: Remove `role="form"` from `yii\bootstrap\ActiveForm` according to new aria specification (bastardijke)
- Enh #208: Added `yii\bootstrap\Modal::$bodyOptions` to allow add options to body part Modal (KoJIT2009)
2.0.6 March 17, 2016
......
......@@ -48,6 +48,12 @@ class Modal extends Widget
* @since 2.0.1
*/
public $headerOptions;
/**
* @var array body options
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @since 2.0.7
*/
public $bodyOptions = ['class' => 'modal-body'];
/**
* @var string the footer content in the modal window.
*/
......@@ -149,7 +155,7 @@ class Modal extends Widget
*/
protected function renderBodyBegin()
{
return Html::beginTag('div', ['class' => 'modal-body']);
return Html::beginTag('div', $this->bodyOptions);
}
/**
......
<?php
namespace yiiunit\extensions\bootstrap;
use yii\bootstrap\Modal;
/**
* @group bootstrap
*/
class ModalTest extends TestCase
{
public function testBodyOptions()
{
$out = Modal::widget([
'bodyOptions' => ['class' => 'modal-body test', 'style' => 'text-align:center;']
]);
$expected = <<<EXPECTED
<div id="w1" class="fade modal" role="dialog" tabindex="-1">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body test" style="text-align:center;">
</div>
</div>
</div>
</div>
EXPECTED;
$this->assertEqualsWithoutLE($expected, $out);
}
}
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