Class humhub\components\rendering\LayoutRenderer

Inheritancehumhub\components\rendering\LayoutRenderer » humhub\components\rendering\ViewPathRenderer » yii\base\BaseObject
Implementshumhub\components\rendering\Renderer
Subclasseshumhub\components\rendering\MailLayoutRenderer, humhub\modules\activity\components\ActivityMailRenderer, humhub\modules\activity\components\ActivityWebRenderer
Available since version1.2

A LayoutRenderer subclass can be used to render layout based views by setting the $viewPath and $layout properties.

The $viewPath defines the path where the target view file resides. For a viewable with the viewName 'myView.php' the renderer will render the view:

'/myView.php'

where viewPath can also be provided as a Yii alias.

The rendered view will be embeded into the given $layout which should point to the layout file and can also be provided as a Yii alias e.g:

'@myModule/views/layouts/myLayout.php'

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$layout string Layout file path humhub\components\rendering\LayoutRenderer
$parent boolean If set to true the renderer will search in the parents view directory for the view. humhub\components\rendering\ViewPathRenderer
$subPath string A subpath within the view folder used for searching the view e. humhub\components\rendering\ViewPathRenderer
$viewPath string View path humhub\components\rendering\ViewPathRenderer

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getViewFile() Returnes the viewFile of the given Viewable. humhub\components\rendering\ViewPathRenderer
getViewPath() Returns the directory containing the view files for this event. humhub\components\rendering\ViewPathRenderer
render() If a $layout is given the result will embed the rendered viewFile into the given $layout. humhub\components\rendering\LayoutRenderer
renderView() Helper function for rendering a Viewable with the given viewParams. humhub\components\rendering\ViewPathRenderer

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getLayout() Returns the layout file path. humhub\components\rendering\LayoutRenderer
suffix() Checks if the given $viewName has a file suffix or not. humhub\components\rendering\ViewPathRenderer

Property Details

$layout public property

Layout file path

public string $layout null

Method Details

getLayout() protected method

Returns the layout file path.

Subclasses may use the $viewable to determine the layout path.

protected string getLayout ( humhub\components\rendering\Viewable $viewable )
$viewable humhub\components\rendering\Viewable
render() public method

If a $layout is given the result will embed the rendered viewFile into the given $layout.

public string render ( humhub\components\rendering\Viewable $viewable, $params = [] )
$viewable humhub\components\rendering\Viewable
$params \humhub\components\rendering\type