Skip to content

Commit

Permalink
fix: i18n and widget for yii2 2.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
krissss committed Jul 15, 2019
1 parent d058194 commit 187da28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
11 changes: 10 additions & 1 deletion widgets/SimpleActiveForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,24 @@ public function init()
public function run()
{
$header = $this->renderHeader();
$content = parent::run();
$content = ob_get_clean();
$footer = $this->renderFooter();

$beginForm = Html::beginForm($this->action, $this->method, $this->options);
if ($this->enableClientScript) {
$this->registerClientScript();
}
$endFrom = Html::endForm();

$html = <<<HTML
<div class="box box-default">
{$beginForm}
{$header}
<div class="box-body">
{$content}
</div>
{$footer}
{$endFrom}
</div>
HTML;
return $html;
Expand Down
12 changes: 10 additions & 2 deletions widgets/SimpleAjaxForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace kriss\widgets;

use kartik\widgets\ActiveForm;
use Yii;
use yii\base\Widget;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

class SimpleAjaxForm extends ActiveForm
{
Expand Down Expand Up @@ -55,18 +55,26 @@ public function run()
{
$modalSize = $this->modalSize ? ('modal-' . $this->modalSize) : '';
$modalHeader = $this->renderHeader();
$modalBody = parent::run();
$modalBody = ob_get_clean();
$modalFooter = $this->renderFooter();

$beginForm = Html::beginForm($this->action, $this->method, $this->options);
if ($this->enableClientScript) {
$this->registerClientScript();
}
$endFrom = Html::endForm();

$html = <<<HTML
<div class="modal fade ajax_modal">
<div class="modal-dialog {$modalSize}">
<div class="modal-content">
{$beginForm}
{$modalHeader}
<div class="modal-body">
{$modalBody}
</div>
{$modalFooter}
{$endFrom}
</div>
</div>
</div>
Expand Down

0 comments on commit 187da28

Please sign in to comment.