diff --git a/Button.php b/Button.php index 0c21a3e..0dc25a9 100644 --- a/Button.php +++ b/Button.php @@ -56,7 +56,7 @@ class Button extends Widget */ public function run() { - echo Html::tag($this->tagName, $this->encodeLabel ? Html::encode($this->label) : $this->label, $this->options); $this->registerPlugin('button'); + return Html::tag($this->tagName, $this->encodeLabel ? Html::encode($this->label) : $this->label, $this->options); } } diff --git a/ButtonDropdown.php b/ButtonDropdown.php index 3563d71..3d74a5b 100644 --- a/ButtonDropdown.php +++ b/ButtonDropdown.php @@ -79,11 +79,13 @@ class ButtonDropdown extends Widget $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); - echo Html::beginTag($tag, $this->containerOptions); - echo "\n" . $this->renderButton(); - echo "\n" . $this->renderDropdown(); - echo "\n" . Html::endTag($tag); $this->registerPlugin('button'); + return implode("\n", [ + Html::beginTag($tag, $this->containerOptions), + $this->renderButton(), + $this->renderDropdown(), + Html::endTag($tag) + ]); } /** diff --git a/ButtonGroup.php b/ButtonGroup.php index 91bed41..c4459a0 100644 --- a/ButtonGroup.php +++ b/ButtonGroup.php @@ -67,8 +67,8 @@ class ButtonGroup extends Widget */ public function run() { - echo Html::tag('div', $this->renderButtons(), $this->options); BootstrapAsset::register($this->getView()); + return Html::tag('div', $this->renderButtons(), $this->options); } /** diff --git a/Carousel.php b/Carousel.php index 68c3def..468b316 100644 --- a/Carousel.php +++ b/Carousel.php @@ -81,12 +81,14 @@ class Carousel extends Widget */ public function run() { - echo Html::beginTag('div', $this->options) . "\n"; - echo $this->renderIndicators() . "\n"; - echo $this->renderItems() . "\n"; - echo $this->renderControls() . "\n"; - echo Html::endTag('div') . "\n"; $this->registerPlugin('carousel'); + return implode("\n", [ + Html::beginTag('div', $this->options), + $this->renderIndicators(), + $this->renderItems(), + $this->renderControls(), + Html::endTag('div') + ]); } /** diff --git a/Collapse.php b/Collapse.php index 22e022e..0222a5a 100644 --- a/Collapse.php +++ b/Collapse.php @@ -76,10 +76,12 @@ class Collapse extends Widget */ public function run() { - echo Html::beginTag('div', $this->options) . "\n"; - echo $this->renderItems() . "\n"; - echo Html::endTag('div') . "\n"; $this->registerPlugin('collapse'); + return implode("\n", [ + Html::beginTag('div', $this->options), + $this->renderItems(), + Html::endTag('div') + ]); } /** diff --git a/Dropdown.php b/Dropdown.php index 14fc158..7537b7b 100644 --- a/Dropdown.php +++ b/Dropdown.php @@ -73,9 +73,9 @@ class Dropdown extends Widget */ public function run() { - echo $this->renderItems($this->items, $this->options); BootstrapPluginAsset::register($this->getView()); $this->registerClientEvents(); + return $this->renderItems($this->items, $this->options); } /** diff --git a/Nav.php b/Nav.php index bfeb606..e5d132f 100644 --- a/Nav.php +++ b/Nav.php @@ -115,8 +115,8 @@ class Nav extends Widget */ public function run() { - echo $this->renderItems(); BootstrapAsset::register($this->getView()); + return $this->renderItems(); } /** diff --git a/Progress.php b/Progress.php index dbeed97..4e7d903 100644 --- a/Progress.php +++ b/Progress.php @@ -105,10 +105,12 @@ class Progress extends Widget */ public function run() { - echo Html::beginTag('div', $this->options) . "\n"; - echo $this->renderProgress() . "\n"; - echo Html::endTag('div') . "\n"; BootstrapAsset::register($this->getView()); + return implode("\n", [ + Html::beginTag('div', $this->options), + $this->renderProgress(), + Html::endTag('div') + ]); } /**