From 034d57071f7bb91074c0c2728c60ae8abdaa0e47 Mon Sep 17 00:00:00 2001 From: KoJIT2009 Date: Wed, 2 Aug 2017 18:52:13 +0500 Subject: [PATCH] Fixes #208: Added `yii\bootstrap\Modal::$bodyOptions` to allow add options to body part Modal --- CHANGELOG.md | 1 + Modal.php | 8 +++++++- tests/ModalTest.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/ModalTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 513c385..519d126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Modal.php b/Modal.php index 6555135..96b1264 100644 --- a/Modal.php +++ b/Modal.php @@ -49,6 +49,12 @@ class Modal extends Widget */ 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. */ public $footer; @@ -149,7 +155,7 @@ class Modal extends Widget */ protected function renderBodyBegin() { - return Html::beginTag('div', ['class' => 'modal-body']); + return Html::beginTag('div', $this->bodyOptions); } /** diff --git a/tests/ModalTest.php b/tests/ModalTest.php new file mode 100644 index 0000000..5b8903c --- /dev/null +++ b/tests/ModalTest.php @@ -0,0 +1,39 @@ + ['class' => 'modal-body test', 'style' => 'text-align:center;'] + ]); + + + $expected = << + + +EXPECTED; + + $this->assertEqualsWithoutLE($expected, $out); + } +}