mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #2912: Relative view files will be looked for under the directory containing the view currently being rendered
This commit is contained in:
@ -173,7 +173,7 @@ class Widget extends Component implements ViewContextInterface
|
||||
*
|
||||
* If the view name does not contain a file extension, it will use the default one `.php`.
|
||||
|
||||
* @param string $view the view name. Please refer to [[findViewFile()]] on how to specify a view name.
|
||||
* @param string $view the view name.
|
||||
* @param array $params the parameters (name-value pairs) that should be made available in the view.
|
||||
* @return string the rendering result.
|
||||
* @throws InvalidParamException if the view file does not exist.
|
||||
@ -206,15 +206,4 @@ class Widget extends Component implements ViewContextInterface
|
||||
|
||||
return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the view file based on the given view name.
|
||||
* File will be searched under [[viewPath]] directory.
|
||||
* @param string $view the view name.
|
||||
* @return string the view file path. Note that the file may not exist.
|
||||
*/
|
||||
public function findViewFile($view)
|
||||
{
|
||||
return $this->getViewPath() . DIRECTORY_SEPARATOR . $view;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user