Commit 5ab58ac1 by Ivan Lemeshev Committed by Alexander Makarov

Fixes #6991: Fixed exception when using `{use class='yii\bootstrap\Nav' type='function'}`

parent d8622223
...@@ -5,6 +5,7 @@ Yii Framework 2 smarty extension Change Log ...@@ -5,6 +5,7 @@ Yii Framework 2 smarty extension Change Log
----------------------- -----------------------
- Bug #6845: Fixed incorrect implementation of `{registerCssFile` and `{registerJsFile` (TomassunGitHub, samdark) - Bug #6845: Fixed incorrect implementation of `{registerCssFile` and `{registerJsFile` (TomassunGitHub, samdark)
- Bug #6991: Fixed exception when using `{use class='yii\bootstrap\Nav' type='function'}` (ivanlemeshev)
2.0.2 January 11, 2015 2.0.2 January 11, 2015
......
...@@ -159,7 +159,7 @@ class ViewRenderer extends BaseViewRenderer ...@@ -159,7 +159,7 @@ class ViewRenderer extends BaseViewRenderer
if (count($methodInfo) === 2) { if (count($methodInfo) === 2) {
$alias = $methodInfo[1]; $alias = $methodInfo[1];
if (isset($this->widgets['functions'][$alias])) { if (isset($this->widgets['functions'][$alias])) {
if (($methodInfo[0] === '_widget_func') && (count($args) === 2)) { if (($methodInfo[0] === '_widget_function') && (count($args) === 2)) {
return $this->widgetFunction($this->widgets['functions'][$alias], $args[0], $args[1]); return $this->widgetFunction($this->widgets['functions'][$alias], $args[0], $args[1]);
} }
} elseif (isset($this->widgets['blocks'][$alias])) { } elseif (isset($this->widgets['blocks'][$alias])) {
......
...@@ -92,6 +92,12 @@ class ViewRendererTest extends TestCase ...@@ -92,6 +92,12 @@ class ViewRendererTest extends TestCase
$this->assertFalse(strpos($content, 'extends1 block') !== false, 'extends1 block should not be there:' . $content); $this->assertFalse(strpos($content, 'extends1 block') !== false, 'extends1 block should not be there:' . $content);
} }
public function testUse()
{
$view = $this->mockView();
$view->renderFile('@yiiunit/extensions/smarty/views/use.tpl');
}
/** /**
* @return View * @return View
*/ */
......
{use class='yii\helpers\Html'}
{use class='yii\bootstrap\Nav' type='function'}
{use class='yii\bootstrap\NavBar' type='block'}
{NavBar brandLabel=$app->name brandUrl=$app->homeUrl
options=['class' => 'test']}
{Nav options=['class' => 'test2'] items=[
['label' => 'Home', 'url' => 'http://example.com/']
]}
{/NavBar}
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